taskSubmit.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>提交任务</title>
  6. <link href="/css/ims/base.css" rel="stylesheet">
  7. <link href="/css/ims/ims.css" rel="stylesheet">
  8. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css" />
  9. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css" />
  10. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css" />
  11. <style>
  12. .ims-box {
  13. margin: 20px;
  14. }
  15. .screen {
  16. padding-left: 20px;
  17. height: 44px;
  18. line-height: 44px;
  19. background-color: #eff4fa;
  20. }
  21. .screen li {
  22. float: left;
  23. margin-right: 65px;
  24. }
  25. .bg-d9bf6e {
  26. margin-left: 5px;
  27. padding: 0 20px;
  28. color: #fff;
  29. background-color: #d9bf6e;
  30. }
  31. .list {
  32. padding: 0 40px;
  33. /*margin-top: 40px;*/
  34. overflow: hidden;
  35. }
  36. .list h2 {
  37. line-height: 30px;
  38. font-size: 14px;
  39. }
  40. .list .student-list_box {
  41. width: 500px;
  42. margin-bottom: 15px;
  43. }
  44. .list .student-list_box>ul {
  45. height: 260px;
  46. overflow: auto;
  47. padding: 20px;
  48. background-color: #eef3ff;
  49. }
  50. .list .student-list_box li {
  51. line-height: 30px;
  52. cursor: pointer;
  53. }
  54. .list .student-list {
  55. display: none;
  56. margin-left: 20px;
  57. }
  58. .list .student-list li.active .btn-select_all {
  59. display: inline-block;
  60. }
  61. .list .student-list span {
  62. cursor: pointer;
  63. }
  64. .list .btn-select_all {
  65. margin-left: 84px;
  66. color: #008000;
  67. }
  68. .student-name_box li {
  69. position: relative;
  70. margin-left: 28px;
  71. line-height: 30px;
  72. }
  73. .student-name_box input {
  74. position: absolute;
  75. left: 155px;
  76. top: 8px;
  77. }
  78. .btn-select_all,
  79. .student-name_box {
  80. display: none;
  81. }
  82. .student-selected {
  83. width: 320px;
  84. height: 300px;
  85. overflow: auto;
  86. }
  87. .student-selected li {
  88. float: left;
  89. margin-right: 24px;
  90. margin-bottom: 12px;
  91. width: 280px;
  92. height: 26px;
  93. line-height: 26px;
  94. text-indent: 20px;
  95. background-color: #f2f2f2;
  96. }
  97. .student-selected .btn-delete {
  98. float: right;
  99. margin-right: 20px;
  100. color: red;
  101. cursor: pointer;
  102. }
  103. .btn-confirm_purchase {
  104. display: block;
  105. margin: 0 auto;
  106. margin-top: 100px;
  107. margin-bottom: 50px;
  108. width: 430px;
  109. line-height: 54px;
  110. color: #fff;
  111. font-family: PingFangSC-Regular, "PingFang SC";
  112. font-weight: 400;
  113. font-style: normal;
  114. font-size: 20px;
  115. text-align: center;
  116. background-color: rgba(0, 153, 102, 1);
  117. cursor: pointer;
  118. }
  119. .sale-table input {
  120. border: 1px solid #ccc;
  121. border-radius: 4px;
  122. }
  123. #imgPreview {
  124. display: inline-block;
  125. position: relative;
  126. margin-top: 12px;
  127. }
  128. #imgPreview > img {
  129. max-width: 100px;
  130. max-height: 100px;
  131. /*margin-right: 5px;*/
  132. }
  133. #imgPreview .delete {
  134. position: relative;
  135. top: -25px;
  136. right: 10px;
  137. /* width: 50px;
  138. height: 50px;
  139. display: none;*/
  140. }
  141. .layui-layer-btn .layui-layer-btn0 {
  142. border-color: #15ae68 !important;
  143. background-color: #15ae68 !important;
  144. color: #fff;
  145. }
  146. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  147. line-height: 140px;
  148. text-align: center;
  149. }
  150. .layui-layer-content{
  151. text-align: center;
  152. }
  153. .layui-layer-content img {
  154. max-width: 100% !important;
  155. max-height: 100% !important;
  156. }
  157. </style>
  158. </head>
  159. <body>
  160. <h3 class="sale-title">提交任务</h3>
  161. <input type="hidden" name="itemName">
  162. <input type="hidden" name="itemSpec">
  163. <input type="hidden" name="itemCode">
  164. <input type="hidden" name="unitId">
  165. <div class="sale-table">
  166. <table width="100%">
  167. <tr>
  168. <th>清洁时间</th>
  169. <td >
  170. <?php echo date('Y-m-d H:i:s'); ?>
  171. </td>
  172. <th>提交截止时间</th>
  173. <td >
  174. <?php echo $epDate; ?>
  175. </td>
  176. </tr>
  177. <tr>
  178. <th>发货凭证</th>
  179. <td colspan="3">
  180. <label class="add-img">
  181. <span>+</span>
  182. <input type="file" id="uploadImg" accept="image/*" multiple="multiple" style="display: none;"/>
  183. </label>
  184. <span>图片上传</span>
  185. <div id="imgPreview">
  186. <?php if(!empty($images)){
  187. foreach($images as $v){
  188. ?>
  189. <img class="preview" src="<?php echo $v; ?>"><a href="#"><img src="/images/icon-delete.png" class="delete"></a>
  190. <?php
  191. }
  192. }?>
  193. </div>
  194. </td>
  195. </tr>
  196. <tr>
  197. <th>备注</th>
  198. <td colspan="3">
  199. <textarea name="remark" id="remark" cols="90" class="use-explain" rows="5"><?php echo $remark; ?></textarea>
  200. </td>
  201. </tr>
  202. </table>
  203. <table width="100%" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" id="P_list">
  204. <tr>
  205. <td>设备编号</td>
  206. <td>设备名称</td>
  207. <td>规格</td>
  208. <td>设备状态</td>
  209. </tr>
  210. <tr>
  211. <td><?php echo $fixedCode; ?></td>
  212. <td><?php echo $itemName; ?></td>
  213. <td><?php echo $itemSpec; ?></td>
  214. <td><?php echo $fixedStatus; ?></td>
  215. <input type="hidden" id="epsId" value="<?php echo $epsId; ?>" />
  216. </tr>
  217. </table>
  218. </div>
  219. <div class="sale-submit" style="margin-top: 25px;">
  220. <button type="button" class="label-primary-s bth-s" id="savebutton">提交</button>
  221. </div>
  222. <script src="/js/jquery-2.2.2.min.js" ></script>
  223. <script src="/js/jquery.datetimepicker.js"></script>
  224. <script src="/js/layer/layer.js"></script>
  225. <script src="/js/xsgl.js"></script>
  226. <script>
  227. $(document).ready(function () {
  228. // 添加图片
  229. $("#uploadImg").on("change", function () {
  230. //限制图片数量
  231. var imgObj = $('#imgPreview img');
  232. var files = document.getElementById('uploadImg').files;
  233. for(var i=0;i<files.length;i++){
  234. var formData = new FormData();
  235. formData.append('uploadFile', document.getElementById('uploadImg').files[i]);
  236. var basic = "<?php echo $basic;?>";
  237. $.ajax({
  238. url: "<?php echo $uploadUrl;?>",
  239. type: "post",
  240. data: formData,
  241. processData: false,
  242. contentType: false,
  243. beforeSend: function (req) {
  244. req.setRequestHeader("Authorization", basic);
  245. },
  246. success: function (data) {
  247. console.log(data);
  248. if (data.errCode == '00') {
  249. var html = "<img class=\"preview\" src='" + data.data.url + "'><a href=\"#\">\n" +
  250. " <img src=\"/images/icon-delete.png\" class=\"delete\" />\n" +
  251. " </a>";
  252. $('#imgPreview').append(html);
  253. $('#uploadImg').val('');
  254. } else {
  255. layer.msg(data.errMsg);
  256. }
  257. }
  258. });
  259. }
  260. });
  261. //删除图片
  262. $("body").on("click", ".delete", function () {
  263. var obj = $(this);
  264. var pic = $(this).parent().prev();
  265. var imgUrl = $(this).attr('src');
  266. layer.confirm('您确定删除此图片吗?', {
  267. btn: ['确定', '取消'] //按钮
  268. }, function () {
  269. obj.remove();
  270. pic.remove();
  271. layer.closeAll();
  272. });
  273. });
  274. // //查看图片
  275. $('body').on('click', '.preview', function () {
  276. var src = $(this).attr('src');
  277. layer.open({
  278. type: 1,
  279. title: '查看图片',
  280. btn: ['关闭'],
  281. area: ['800px', '500px'], //宽高
  282. btnAlign: 'c',
  283. content: '<img src="'+src+'" alt="" style="margin-top:5px;">',
  284. yes: function (index, layero) {
  285. layer.closeAll();
  286. }
  287. });
  288. })
  289. $(".bth-s").click(function(){
  290. layer.confirm('确认提交吗?', {
  291. btn: ['确定', '取消'] //按钮
  292. }, function () {
  293. if($('.preview').length < 1){
  294. layer.msg('请至少上传一张图片');
  295. return false;
  296. }
  297. var picArray = new Array();
  298. for(var i=0;i<$('.preview').length;i++)
  299. {
  300. picArray[i] = $('.preview').eq(i).attr('src');
  301. }
  302. var data = {
  303. images: picArray,
  304. remark: $('#remark').val(),
  305. epsId:$('#epsId').val(),
  306. flag:999
  307. };
  308. alertIndex=layer.msg('正在保存,请稍候',{time:0});
  309. $('.bth-s').attr('disabled',true);
  310. $.ajax({
  311. url: "<?php echo $this->createUrl('imsDevice/taskSubmit');?>",
  312. type: "post",
  313. data:data,
  314. dataType: "json",
  315. success: function (data) {
  316. layer.close(alertIndex);
  317. if (data.status === 1) {
  318. layer.alert("保存成功", {icon: 1,closeBtn:0}, function () {
  319. window.location.href = "<?php echo $this->createUrl('imsDevice/taskClean');?>";
  320. })
  321. }else {
  322. $('.bth-s').attr('disabled',false);
  323. layer.msg(data.msg);
  324. }
  325. }
  326. });
  327. });
  328. });
  329. })
  330. </script>
  331. <?php //include_once '_allocationJs.php'?>
  332. </body>
  333. </html>