商丘12345 前端

addAppealOrder.html 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../Script/Common/huayi.load.js"></script>
  6. <script src="../Script/Common/huayi.config.js"></script>
  7. <!--<link href="../js/bootstrap-select/css/bootstrap-select.css" rel="stylesheet" />-->
  8. <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
  9. <link rel="stylesheet" href="../css/init.css" />
  10. <link rel="stylesheet" href="../css/notification/css/notifucation.css" />
  11. <link rel="stylesheet" href="../css/notification/css/addNotifucation.css">
  12. <title></title>
  13. <style type="text/css">
  14. .xl{
  15. right: -32px;
  16. }
  17. .orderType{
  18. /*width: 196px;*/
  19. height: 35px;
  20. padding: 0;
  21. border-color: rgb(169, 169, 169);
  22. }
  23. ul li{
  24. list-style: none;
  25. }
  26. .inpBox {
  27. border: 1px solid #cccccc;
  28. height: 31px;
  29. width: 75%;
  30. display: inline-block;
  31. position: relative;
  32. vertical-align: middle;
  33. position: absolute;
  34. /*left: 0px;
  35. top: 0px;*/
  36. z-index: 111;
  37. }
  38. .selDpart1{
  39. position: absolute;
  40. left: 0px;
  41. top: 30px;
  42. z-index: 11111;
  43. width: 220px;
  44. line-height: 30px;
  45. background: #FFFFFF;
  46. display: none;
  47. }
  48. #sponsor{
  49. width: 218px;
  50. border: 1px solid #00a1cb;
  51. margin: 0;
  52. padding: 0;
  53. list-style: none;
  54. max-height: 212px;
  55. overflow-x: hidden;
  56. overflow-y: scroll;
  57. }
  58. #sponsor li{
  59. margin: 0;
  60. padding-left: 10px;
  61. width: 220px;
  62. height: 30px;
  63. line-height: 30px;
  64. list-style: none;
  65. }
  66. #sponsor li:hover{
  67. background: #00a1cb;
  68. }
  69. .addTree {
  70. background: #fff;
  71. position: absolute;
  72. width: 100%;
  73. border: 1px solid darkgrey;
  74. right: 0;
  75. top: 29px;
  76. display: none;
  77. z-index: 222;
  78. }
  79. .xl {
  80. display: inline-block;
  81. background: url(../../img/dropDown.png) no-repeat;
  82. height: 100%;
  83. background-position: center center;
  84. width: 20px;
  85. position: absolute;
  86. right: 0;
  87. top: 0px;
  88. /* background-color: #f7bc8b; */
  89. cursor: pointer;
  90. }
  91. .ztree li span {
  92. border: none;
  93. padding: 0;
  94. }
  95. .inps {
  96. width: 76%;
  97. height: 29px;
  98. outline: none;
  99. border: 0;
  100. border-image-width: 0;
  101. padding: 0;
  102. padding-left: 3px;
  103. }
  104. .xl {
  105. display: inline-block;
  106. background: url(../img/dropDown.png) no-repeat;
  107. height: 100%;
  108. background-position: center center;
  109. width: 20px;
  110. position: absolute;
  111. right: 0;
  112. top: 0px;
  113. /* background-color: #f7bc8b; */
  114. cursor: pointer;
  115. }
  116. .Cleans {
  117. display: inline-block;
  118. width: 20px;
  119. position: absolute;
  120. right: 21px;
  121. top: 8px;
  122. display: none;
  123. }
  124. .reasons{
  125. display: none;
  126. }
  127. .other_reasons{
  128. width: 75%;
  129. }
  130. .remark{
  131. width: 75%;
  132. }
  133. .appeal-input{
  134. width: 75%;
  135. height: 34px;
  136. }
  137. #scwj{
  138. background-color: #FFF;
  139. background-image: none;
  140. border: 1px solid #ccc;
  141. border-radius: 1px;
  142. color: inherit;
  143. padding: 6px 12px!important;
  144. }
  145. </style>
  146. </head>
  147. <body>
  148. <div class="container" style="margin-left: 15px;">
  149. <div class="tab_contents" id="tab_user_contents">
  150. <ul class="project_items form-horizontal showtabs">
  151. <li class="form-group">
  152. <label for="customer_layer" class="col-md-2" >通报部门:</label>
  153. <div class="inpBox">
  154. <input type="text" class="inps" onkeyup="darptSearch()"/>
  155. <i class="Cleans fa fa-close"></i>
  156. <i class="xl xl_one"></i>
  157. <div class="addTree xlAdd">
  158. <ul id="addTreeDemo" class="ztree"></ul>
  159. </div>
  160. </div>
  161. </li>
  162. <li class="form-group">
  163. <label for="customer_layer" class="col-md-2 appeal-reason-title" style="float: left;">申诉原因:</label>
  164. <div class="col-md-9" style="width: 75%; float: left; padding: 0;">
  165. <select name="" class="form-control orderType">
  166. <option value="0">请选择通报原因</option>
  167. </select>
  168. </div>
  169. </li>
  170. <li class="form-group drop_down reasons">
  171. <label for="customer_layer" class="col-md-2" style="float: left;">其他原因:</label>
  172. <textarea name="" rows="" cols="" class="other_reasons"></textarea>
  173. </li>
  174. <li class="form-group">
  175. <label for="customer_layer" class="col-md-2" style="float: left;">申诉依据:</label>
  176. <input class="appeal-input" id="addBasis" />
  177. </li>
  178. <li class="form-group">
  179. <label for="customer_layer" class="col-md-2" style="float: left;">申诉要求:</label>
  180. <input class="appeal-input" id="addRequirement" />
  181. </li>
  182. <li class="form-group drop_down">
  183. <label class="col-md-2" style="float: left;">申诉详情:</label>
  184. <textarea name="" rows="" cols="" class="remark"></textarea>
  185. </li>
  186. <li>
  187. <label for="customer_layer" class="col-md-2" style="float: left;">证明材料:</label>
  188. <div class="fileBox">
  189. </div>
  190. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  191. <input class="input" type="button" value="上传" id="scwj" />
  192. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  193. <input type="hidden" id="file" />
  194. <span style="color:#FF0000; border: none;">
  195. (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
  196. </span>
  197. </li>
  198. </ul>
  199. <div class="form-group clearfix" style="text-align: center;">
  200. <div class="col-md-offset-5 col-md-10">
  201. <button class="project_save btn btn-primary" id="save_btns" type="submit">保存</button>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. <input type="hidden" id="PID" />
  207. <input type="hidden" id="Dpment" />
  208. <script type="text/javascript">
  209. $(function(){
  210. var id = helper.request.queryString("ids");
  211. var wid = helper.request.queryString("wid");
  212. var assessment_list = helper.request.queryString("assessment_list");
  213. var fid = helper.request.queryString("fid");
  214. tree();
  215. //所属分类下拉
  216. $('.inps').focus(function () {
  217. $('.xlAdd').css('display', 'block')
  218. })
  219. $('.xl').click(function () {
  220. if ($('.xlAdd').css('display') == 'block') {
  221. $('.xlAdd').css('display', 'none')
  222. } else {
  223. $('.xlAdd').css('display', 'block')
  224. }
  225. })
  226. $('.addTree').mouseleave(function () {
  227. $(this).css('display', 'none')
  228. })
  229. //清除
  230. $(".Cleans ").click(function () {
  231. $('.inps').val("");
  232. $("#PID").val("");
  233. $("#Dpment").val("");
  234. })
  235. //上传附件
  236. $("#scwj").click(function() {
  237. $("#upFile").trigger("click");
  238. })
  239. $("#upFile").change(function() {
  240. upload();
  241. })
  242. //获取部门
  243. function tree() {
  244. $.get(huayi.config.callcenter_url + 'Department/GetDeptList', {
  245. "token": $.cookie("token"),
  246. // "pid": pid
  247. }, function (result) {
  248. result = $.parseJSON(result);
  249. $.fn.zTree.init($("#addTreeDemo"), setting1, result.data); //实例化树形图
  250. });
  251. }
  252. var setting1 = {
  253. data: {
  254. key: {
  255. name: "F_DeptName"
  256. },
  257. simpleData: {
  258. enable: true,
  259. idKey: "F_DeptId",
  260. pIdKey: "F_PartentId",
  261. rootPId: 0
  262. }
  263. },
  264. callback: {
  265. onClick: zTreeOnClick
  266. }
  267. };
  268. function zTreeOnClick(event, treeId, treeNode) {
  269. if (treeNode.level >= 2) {
  270. $('.inps').val(treeNode.F_DeptName);
  271. $("#PID").val(treeNode.F_DeptId);
  272. $("#Dpment").val(treeNode.F_DeptId);
  273. $(".Cleans").show();
  274. }
  275. };
  276. //通报原因
  277. getOrderType();
  278. function getOrderType() {
  279. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByParentId', {
  280. "token": $.cookie("token"),
  281. pid: 69
  282. }, function(result) {
  283. result = $.parseJSON(result);
  284. var Count = result.data;
  285. $(Count).each(function(i, n) {
  286. $('<option value="' + n.F_ValueId + '">' + n.F_Value + '</option>').appendTo($(".orderType"));
  287. })
  288. });
  289. }
  290. $('.orderType').change(function() {
  291. if($('.orderType').val()==77){
  292. $('.reasons').css('display','block')
  293. }else{
  294. $('.reasons').css('display','none')
  295. }
  296. })
  297. /*
  298. 获取通报详情
  299. assessment_list = 8 为通报页面
  300. */
  301. if(assessment_list === "8") {
  302. $(".appeal-reason-title").text("通报原因:");
  303. $(".orderType").attr("disabled","disabled");
  304. $.get(huayi.config.callcenter_url + 'NoticeCriticism/GetNotice', {
  305. nid: fid,
  306. "token": $.cookie("token")
  307. }, function(result) {
  308. result = $.parseJSON(result);
  309. if(result.state.toLowerCase() == "success") {
  310. var con = result.data;
  311. if(con.dModel.F_NoticeID==77){
  312. $('.reasons').css('display','block')
  313. }else{
  314. $('.reasons').css('display','none')
  315. }
  316. $('.inps').val(con.NoticeDeptName);//部门名称
  317. $("#PID").val(con.dModel.F_DeptIds);//部门id
  318. $('.orderType').val(con.dModel.F_NoticeID);//通报原因
  319. $('.other_reasons').val(con.dModel.F_Content);//其他原因
  320. }
  321. })
  322. }
  323. /*
  324. 保存
  325. 判断 添加、修改
  326. */
  327. $('#save_btns').click(function() {
  328. if($('#PID').val() == '') {
  329. layer.confirm('请选择 部门!', {
  330. btn: ['确定']
  331. });
  332. return;
  333. }
  334. var customertype=$('.orderType').val();
  335. var noticeinfo=$('.orderType option:selected').text();
  336. if(customertype==0){
  337. layer.msg('请填写通报原因');
  338. return
  339. // customertype='';
  340. // noticeinfo=''
  341. }else if(customertype==77 && !$('.other_reasons').val()){
  342. layer.msg('请填写其他原因')
  343. return
  344. }
  345. if(id){
  346. $.post(huayi.config.callcenter_url + 'Appeal/EditAppeal', {
  347. nid:id,
  348. deptids:$('#PID').val(),
  349. noticeid:customertype,
  350. content: $('.other_reasons').val(),//其他原因
  351. noticeinfo: noticeinfo,//通报内容
  352. remark: $(".remark").val(),//申诉详情
  353. basis: $("#addBasis").val(), //申诉依据
  354. requirement: $("#addRequirement").val(), //申诉要求
  355. files: $('#file').val(), //证明材料附件
  356. type: assessment_list, //申诉信息分类
  357. typeid: fid, //申诉信息id
  358. "token": $.cookie("token"),
  359. }, function(result) {
  360. result = $.parseJSON(result);
  361. if(result.state.toLowerCase() == "success") {
  362. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  363. parent.layer.close(index); //再执行关闭
  364. parent.layer.msg("修改成功!");
  365. parent.$('#table1').bootstrapTable('refresh');
  366. }
  367. })
  368. } else {
  369. $.post(huayi.config.callcenter_url + 'Appeal/AddAppeal', {
  370. deptids: $('#PID').val(),
  371. noticeid: customertype,
  372. content: $('.other_reasons').val(),//其他原因
  373. noticeinfo: noticeinfo,//通报内容
  374. workorderid: wid, //工单编号
  375. remark: $(".remark").val(),//申诉详情
  376. basis: $("#addBasis").val(), //申诉依据
  377. requirement: $("#addRequirement").val(), //申诉要求
  378. files:$('#file').val(), //证明材料附件
  379. type: assessment_list, //申诉信息分类
  380. typeid: fid, //申诉信息id
  381. "token": $.cookie("token"),
  382. }, function(result) {
  383. result = $.parseJSON(result);
  384. if(result.state.toLowerCase() == "success") {
  385. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  386. parent.layer.close(index); //再执行关闭
  387. parent.layer.msg("保存成功!");
  388. parent.$('#table1').bootstrapTable('refresh');
  389. }
  390. })
  391. }
  392. })
  393. // 申诉详情
  394. if(id) {
  395. $.get(huayi.config.callcenter_url + 'Appeal/GetAppeal', {
  396. nid: id,
  397. "token": $.cookie("token")
  398. }, function(result) {
  399. result = $.parseJSON(result);
  400. if(result.state.toLowerCase() == "success") {
  401. var con = result.data;
  402. console.log("con",con)
  403. if(con.dt[0].F_NoticeID==77){
  404. $('.reasons').css('display','block')
  405. }else{
  406. $('.reasons').css('display','none')
  407. }
  408. $('.inps').val(con.NoticeDeptName);//部门名称
  409. $("#PID").val(con.dt[0].F_DeptIds);//部门id
  410. $('.orderType').val(con.dt[0].F_NoticeID);//通报原因
  411. $('.other_reasons').val(con.dt[0].F_Content);//其他原因
  412. $('.remark').val(con.dt[0].F_Remark);//其他原因
  413. $("#addBasis").val(con.dt[0].F_Basis);//申诉依据
  414. $("#addRequirement").val(con.dt[0].F_Requirement);//申诉要求
  415. assessment_list = con.dt[0].F_Type; //申诉信息分类
  416. fid = con.dt[0].F_TypeID; //申诉信息id;
  417. $(con.dt[0].File).each(function(k,q){
  418. var strs='<span class="files" fiel-num="'+ q.F_FileId +'">'+ q.F_FileName.substring(19) +'<i class="fa fa-remove del_file"></i></span>'
  419. $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event){
  420. event.stopPropagation();
  421. $(this).parent().remove();
  422. file_num()
  423. console.log($('.fileBox').find('.del_file'))
  424. })
  425. file_num()
  426. })
  427. }
  428. })
  429. }
  430. //上传文件
  431. function upload() {
  432. var Files = document.getElementById("upFile").files;
  433. if(Files.length > 0) {
  434. var formData = new FormData();
  435. for(var i = 0; i < Files.length; i++) {
  436. formData.append('file' + i, Files[i]);;
  437. }
  438. console.log(formData)
  439. formData.append("token", $.cookie("token"));
  440. var typeName=Files[0].name.split('.')[1];
  441. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  442. $.ajax({
  443. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  444. type: "POST",
  445. data: formData,
  446. /**
  447. *必须false才会自动加上正确的Content-Type
  448. */
  449. contentType: false,
  450. /**
  451. * 必须false才会避开jQuery对 formdata 的默认处理
  452. * XMLHttpRequest会对 formdata 进行正确的处理
  453. */
  454. processData: false,
  455. success: function(result) {
  456. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  457. $("#upFile").change(function() {
  458. upload();
  459. });
  460. var r = $.parseJSON(result);
  461. if(r.state.toLowerCase() == "success") {
  462. // $(".fjnr").text(r.data[0].F_FileName);
  463. var a = r.data;
  464. $(a).each(function(i, n) {
  465. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  466. $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event) {
  467. event.stopPropagation();
  468. $(this).parent().remove();
  469. file_num()
  470. })
  471. })
  472. file_num()
  473. }
  474. }
  475. });
  476. }else{
  477. layer.msg("格式不正确");
  478. }
  479. } else {
  480. layer.confirm('请上传文件!', {
  481. btn: ['确定']
  482. });
  483. }
  484. }
  485. //上传文件隐藏域值
  486. function file_num() {
  487. var str = '';
  488. var Str;
  489. $('.fileBox .files').each(function(j, m) {
  490. var aa = $(m).attr("fiel-num")
  491. console.log(aa);
  492. str += aa + ",";
  493. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  494. })
  495. $("#file").val(Str);
  496. }
  497. })
  498. </script>
  499. <!--<script src="../js/bootstrap-select/js/bootstrap-select.js"></script>-->
  500. <script src="../js/laydate/laydate.js"></script>
  501. <script src="../js/zTree/jquery.ztree.core.js"></script>
  502. </body>
  503. </html>