Sin descripción

banli.html 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  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="../css/layer/need/layer.css" />
  8. <link rel="stylesheet" href="../css/init.css" />
  9. <title>办理工单</title>
  10. <style>
  11. .input {
  12. background-color: #fff;
  13. background-image: none;
  14. border: 1px solid #ccc;
  15. border-radius: 1px;
  16. color: inherit;
  17. padding: 6px 12px;
  18. }
  19. .fjnr {
  20. padding: 0 !important;
  21. border: none !important;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <div class="Common">
  27. <table>
  28. <tr>
  29. <th class="Importent">承办人:</th>
  30. <td>
  31. <input id="dealman" list="dealmanList" type="text" style="height: 32px" autocomplete="off" />
  32. <datalist id="dealmanList">
  33. </datalist>
  34. </td>
  35. <th class="Importent">职务:</th>
  36. <td>
  37. <input type="text" id="duties" />
  38. </td>
  39. <th class="Importent">联系方式:</th>
  40. <td>
  41. <input type="text" id="dealcontact" />
  42. </td>
  43. </tr>
  44. <tr>
  45. <th class="Importent">审核领导:</th>
  46. <td>
  47. <input type="text" id="auditUser" />
  48. </td>
  49. <th class="Importent">职务:</th>
  50. <td>
  51. <input type="text" id="auditUserDuties" />
  52. </td>
  53. <th class="Importent">联系方式:</th>
  54. <td>
  55. <input type="text" id="auditContact" />
  56. </td>
  57. </tr>
  58. <tr>
  59. <th class="Importent">办理结果:</th>
  60. <td colspan="5">
  61. <textarea data-adaptheight id="situation" onkeyup="OnFocusFun(this)" name="" rows="6" cols=""></textarea>
  62. <textarea data-adaptheight id="result" hidden="hidden" name="" rows="6" cols=""></textarea>
  63. </td>
  64. </tr>
  65. <tr>
  66. <th class="Importent">是/否向当事人反馈:</th>
  67. <td id="isProResultRadio" style="font-size: 12px">
  68. <label style="margin-right: 10px">
  69. <input type="radio" value="1" name="isDisposeResult" style="vertical-align: -2px" />是
  70. </label>
  71. <label>
  72. <input type="radio" value="0" name="isDisposeResult" style="vertical-align: -2px" />否
  73. </label>
  74. </td>
  75. </tr>
  76. <tr class="dealWithRemark-wrapper">
  77. <th>已办未果备注:</th>
  78. <td colspan="5">
  79. <textarea data-adaptheight id="dealWithRemark" name="" rows="6" cols=""></textarea>
  80. </td>
  81. </tr>
  82. <tr class="prosituation-wrapper">
  83. <th>处理方案/进程:</th>
  84. <td colspan="5">
  85. <textarea data-adaptheight id="prosituation" name="" rows="6" cols=""></textarea>
  86. </td>
  87. </tr>
  88. <tr class="annotation-wrapper">
  89. <th style="color: #ff0000">注释:</th>
  90. <td style="color: #ff0000" colspan="5">
  91. 请提交加盖单位公章的相关说明文件,不添加文件说明将被扣考核分
  92. </td>
  93. </tr>
  94. <tr class="connecttime-wrapper">
  95. <th>沟通时间:</th>
  96. <td>
  97. <input type="text" class="laydate-icon" id="connecttime" style="
  98. width: 172px;
  99. height: 32px;
  100. border-color: rgb(158, 158, 158);
  101. " />
  102. </td>
  103. </tr>
  104. <tr class="connectmode-wrapper">
  105. <th>沟通方式:</th>
  106. <td>
  107. <input type="text" id="connectmode" />
  108. </td>
  109. </tr>
  110. <tr class="isstaisfied-wrapper">
  111. <th>是否满意:</th>
  112. <td id="isStaisfiedRadio" style="font-size: 12px" colspan="5">
  113. <label style="margin-right: 10px">
  114. <input type="radio" value="1" name="isstaisfied" style="vertical-align: -2px" />满意
  115. </label>
  116. <label style="margin-right: 10px">
  117. <input type="radio" value="2" name="isstaisfied" style="vertical-align: -2px" />基本满意
  118. </label>
  119. <label style="margin-right: 10px">
  120. <input type="radio" value="3" name="isstaisfied" style="vertical-align: -2px" />不满意
  121. </label>
  122. </td>
  123. </tr>
  124. <tr class="files-wrappper">
  125. <th class="Importent">附件:</th>
  126. <td colspan="5">
  127. <div class="fileBox"></div>
  128. <!--<span class="fjnr"></span>-->
  129. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple"
  130. style="display: none" />
  131. <input class="input" type="button" value="上传" id="scwj" />
  132. <!--<input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />-->
  133. <input type="hidden" id="file" />
  134. <span style="color: #ff0000; border: none">
  135. (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
  136. </span>
  137. </td>
  138. </tr>
  139. <tr style="display: none;">
  140. <td>
  141. <button class="btns handleBtn">查看办理结果</button>
  142. </td>
  143. <td colspan="5">
  144. <textarea data-adaptheight id="result" name="" rows="4" cols=""></textarea>
  145. </td>
  146. <input type="hidden" id="ID" />
  147. </tr>
  148. </table>
  149. <div class="btn_box">
  150. <!-- <button class="btns BC">保存</button> -->
  151. <button class="btns Submit">提交</button>
  152. </div>
  153. </div>
  154. <script src="../css/laydate/laydate.js"></script>
  155. <script src="../js/adjustHeight.js"></script>
  156. <script src="../Script/Common/huayi.common.js"></script>
  157. <script>
  158. var wid = helper.request.queryString("wid");
  159. var isProtect = helper.request.queryString("isProtect");
  160. var State;
  161. var a = $("#ID").val();
  162. var simpleDetailStrStart = "";
  163. var simpleDetailStrEnd = "";
  164. var simpleDetailStr = "";
  165. Detail();
  166. $(document).ready(function () {
  167. laydate.skin("blue");
  168. laydate({
  169. elem: "#connecttime",
  170. event: "focus",
  171. istoday: true,
  172. istime: true,
  173. type: "datetime",
  174. format: "YYYY-MM-DD hh:mm:ss",
  175. });
  176. simpleDetail();
  177. getHistoryList();
  178. //上传附件
  179. $("#scwj").click(function () {
  180. $("#upFile").trigger("click");
  181. });
  182. $("#upFile").change(function () {
  183. upload('upFile','.fileBox',['png','jpg','mp3','mp4','pdf','doc','docx','xls','xlsx'],"#file");
  184. });
  185. $("#scfj").click(function () {
  186. $(".fjnr").text("");
  187. $("#scfj").hide();
  188. });
  189. $(".BC").click(function () {
  190. if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() == "1") {
  191. if ($("#dealman").val() == "") {
  192. layer.msg("办理人不能为空");
  193. } else if ($("#situation").val() == "") {
  194. layer.msg("处理情况不能为空");
  195. } else if ($("#dealcontact").val() == "") {
  196. layer.msg("联系方式不能为空");
  197. } else if ($("#duties").val() == "") {
  198. layer.msg("职务不能为空");
  199. } else if ($("#result").val() == "") {
  200. layer.msg("请生成办理结果");
  201. } else {
  202. State = 0;
  203. JA();
  204. }
  205. } else if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() == "2") {
  206. State = 0;
  207. JA();
  208. } else if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() == "0") {
  209. State = 0;
  210. JA();
  211. } else {
  212. layer.msg("请选择是/否向当事人反馈");
  213. }
  214. });
  215. $(".Submit").click(function () {
  216. if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() == "1") {
  217. if ($("#dealman").val() == "") {
  218. layer.msg("办理人不能为空");
  219. } else if ($("#situation").val() == "") {
  220. layer.msg("处理情况不能为空");
  221. } else if ($("#dealcontact").val() == "") {
  222. layer.msg("联系方式不能为空");
  223. } else if ($("#duties").val() == "") {
  224. layer.msg("职务不能为空");
  225. }
  226. // else if ($("#result").val() == "") {
  227. // layer.msg("请生成办理结果");
  228. // }
  229. else {
  230. State = 1;
  231. //$("#situation").val(stripscript($("#situation").val()));
  232. $("#result").val($("#situation").val().replace(simpleDetailStrStart, ''))
  233. JA();
  234. }
  235. } else if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() == "2") {
  236. State = 1;
  237. JA();
  238. } else if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() == "0") {
  239. State = 1;
  240. JA();
  241. } else {
  242. layer.msg("请选择是/否向当事人反馈");
  243. }
  244. });
  245. $(".prosituation-wrapper").hide(); //处理方案/进程
  246. $(".annotation-wrapper").hide(); //注释
  247. $(".connecttime-wrapper").hide(); //沟通时间
  248. $(".connectmode-wrapper").hide(); //沟通方式
  249. // $(".replycontent-wrapper").hide(); //答复内容
  250. $(".isstaisfied-wrapper").hide(); //是否满意
  251. $(".dealWithRemark-wrapper").hide(); // 已办未果备注
  252. /*
  253. * 处理结果
  254. * 默认 0
  255. * 是 1
  256. * 否 2
  257. */
  258. $("#isProResultRadio")
  259. .find('input[type="radio"]')
  260. .on("change", function () {
  261. $("#prosituation").val(""); //处理方案/进程
  262. $("#connecttime").val(""); //沟通时间
  263. $("#connectmode").val(""); //沟通方式
  264. // $("#replycontent").val(""); //答复内容
  265. $("#result").val(""); //办理结果
  266. $(
  267. '#isStaisfiedRadio input[name="isstaisfied"]:checked'
  268. ).prop("checked", false); //是否满意
  269. isProResultJudge($(this).val());
  270. });
  271. $(".handleBtn").click(function () {
  272. // if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() === "1") {
  273. // var isStaisfiedRadioData;
  274. // if (
  275. // $(
  276. // '#isStaisfiedRadio input[name="isstaisfied"]:checked'
  277. // ).val() === "1"
  278. // ) {
  279. // isStaisfiedRadioData = "满意";
  280. // } else if (
  281. // $(
  282. // '#isStaisfiedRadio input[name="isstaisfied"]:checked'
  283. // ).val() === "2"
  284. // ) {
  285. // isStaisfiedRadioData = "基本满意";
  286. // } else if (
  287. // $(
  288. // '#isStaisfiedRadio input[name="isstaisfied"]:checked'
  289. // ).val() === "3"
  290. // ) {
  291. // isStaisfiedRadioData = "不满意";
  292. // } else {
  293. // isStaisfiedRadioData = "未评价";
  294. // }
  295. // simpleDetailStrEnd =
  296. // $("#situation").val() +
  297. // " [办理结果:" +
  298. // "已办理,承办人:" +
  299. // $("#dealman").val() +
  300. // ",职务:" +
  301. // $("#duties").val() +
  302. // ",联系电话:" +
  303. // $("#dealcontact").val() +
  304. // "," +
  305. // $("#dealman").val() +
  306. // "向当事人进行了反馈,当事人对结果表示" +
  307. // isStaisfiedRadioData +
  308. // "。]";
  309. // simpleDetailStr =
  310. // simpleDetailStrStart + simpleDetailStrEnd;
  311. // $("#result").val(simpleDetailStr);
  312. // } else if ($('#isProResultRadio input[name="isDisposeResult"]:checked').val() === "0") {
  313. // simpleDetailStrEnd =
  314. // $("#situation").val() +
  315. // " [办理结果:" +
  316. // "已办理,承办人:" +
  317. // $("#dealman").val() +
  318. // ",职务:" +
  319. // $("#duties").val() +
  320. // ",联系电话:" +
  321. // $("#dealcontact").val() +
  322. // "," +
  323. // $("#dealman").val() +
  324. // "没有向当事人进行反馈" +
  325. // "。]";
  326. // simpleDetailStr =
  327. // simpleDetailStrStart + simpleDetailStrEnd;
  328. // $("#result").val(simpleDetailStr);
  329. // }
  330. simpleDetailStrEnd = $("#situation").val()
  331. simpleDetailStr =
  332. simpleDetailStrStart + simpleDetailStrEnd;
  333. $("#result").val(simpleDetailStr);
  334. });
  335. });
  336. //得到焦点时触发事件
  337. function OnFocusFun(element) {
  338. (element.value.indexOf(simpleDetailStrStart) === 0) || (element.value = simpleDetailStrStart);
  339. }
  340. //交办
  341. function JA() {
  342. $.post(
  343. huayi.config.callcenter_url + "WorkOrder/FeedBackWorkOrder", {
  344. workorderid: wid,
  345. dealman: $("#dealman").val(), //承办人
  346. dealcontact: $("#dealcontact").val(), //联系方式
  347. duties: $("#duties").val(), //职务
  348. AuditUser: $("#auditUser").val(), //审核领导
  349. post: $("#auditUserDuties").val(), //审核领导职务
  350. auditContact: $("#auditContact").val(), //审核领导联系方式
  351. situation: $("#situation").val().replace(simpleDetailStrStart, ''), //处理情况
  352. // result: $("#result").val(), //办理结果
  353. result: $("#situation").val(), //办理结果
  354. isproresult: $(
  355. '#isProResultRadio input[name="isDisposeResult"]:checked'
  356. ).val(), //处理结果
  357. // IsProResult: $(
  358. // '#isProResultRadio input[name="isDisposeResult"]:checked'
  359. // ).val(), // 已办未果
  360. IsProResultState: "", // 已办未果状态
  361. prosituation: $("#prosituation").val(), //处理方案/进程
  362. Unsuccessful: $("#dealWithRemark").val(), //已办未果备注
  363. connecttime: $("#connecttime").val(), //沟通时间
  364. connectmode: $("#connectmode").val(), //沟通方式
  365. // replycontent: $("#replycontent").val(), //答复内容
  366. isstaisfied: $(
  367. '#isStaisfiedRadio input[name="isstaisfied"]:checked'
  368. ).val(), //是否满意
  369. state: State,
  370. feedbackid: a,
  371. files: $("#file").val(),
  372. token: $.cookie("token"),
  373. },
  374. function (result) {
  375. result = JSON.parse(result);
  376. if (result.state.toLowerCase() == "success") {
  377. addHistory();
  378. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  379. parent.layer.close(index); //再执行关闭
  380. parent.$("#orderlist").bootstrapTable("refresh");
  381. parent.layer.msg("办理成功");
  382. $(".fileBox").html("");
  383. }
  384. }
  385. );
  386. }
  387. //草稿详情
  388. function Detail() {
  389. $.getJSON(
  390. huayi.config.callcenter_url + "WorkOrder/GetDraftInfo", {
  391. workorderid: wid,
  392. type: 2,
  393. token: $.cookie("token"),
  394. },
  395. function (result) {
  396. if (result.state.toLowerCase() == "success") {
  397. if (result.data.length > 0) {
  398. var IsProResultValue =
  399. result.data[0].F_IsProResult + "";
  400. isProResultJudge(IsProResultValue);
  401. $("#dealman").val(result.data[0].F_DealUser); //承办人
  402. // $("#result").text(result.data[0].F_Result); //办理结果
  403. $("#situation").val(result.data[0].F_Situation); //处理情况
  404. $("#duties").val(result.data[0].F_Duties); //职务
  405. $('#isProResultRadio input[name="isDisposeResult"][value="' + result.data[0]
  406. .F_IsProResult + '"]').prop("checked", true); //是/否向当事人反馈
  407. $("#prosituation").val(
  408. result.data[0].F_ProSituation
  409. ); //处理方案/进程
  410. $("#dealcontact").val(
  411. result.data[0].F_DealUserContact
  412. ); //联系方式
  413. $("#connecttime").val(
  414. result.data[0].F_ConnectTime
  415. ); //沟通时间
  416. $("#connectmode").val(
  417. result.data[0].F_ConnectMode
  418. ); //沟通方式
  419. // $("#replycontent").val(result.data[0].F_ReplyContent); //答复内容
  420. $(
  421. '#isStaisfiedRadio input[name="isstaisfied"][value="' +
  422. result.data[0].F_IsSatisfied +
  423. '"]'
  424. ).prop("checked", true); //是否满意
  425. a = result.data[0].F_Id;
  426. }
  427. }
  428. }
  429. );
  430. }
  431. //清除
  432. function Clean() {
  433. $("#startTime").val(""), $("#assignedopinion").val("");
  434. }
  435. //上传文件
  436. // function upload() {
  437. // var Files = document.getElementById("upFile").files;
  438. // if (Files.length > 0) {
  439. // var formData = new FormData();
  440. // for (var i = 0; i < Files.length; i++) {
  441. // formData.append("file" + i, Files[i]);
  442. // }
  443. // formData.append("token", $.cookie("token"));
  444. // var typeName = Files[0].name.split(".")[1];
  445. // if (
  446. // typeName == "png" ||
  447. // typeName == "jpg" ||
  448. // typeName == "mp4" ||
  449. // typeName == "mp3" ||
  450. // typeName == "pdf" ||
  451. // typeName == "doc" ||
  452. // typeName == "docx" ||
  453. // typeName == "xls" ||
  454. // typeName == "xlsx"
  455. // ) {
  456. // $.ajax({
  457. // url: huayi.config.callcenter_url +
  458. // "/WorkOrder/UploadFile",
  459. // type: "POST",
  460. // data: formData,
  461. // /**
  462. // *必须false才会自动加上正确的Content-Type
  463. // */
  464. // contentType: false,
  465. // /**
  466. // * 必须false才会避开jQuery对 formdata 的默认处理
  467. // * XMLHttpRequest会对 formdata 进行正确的处理
  468. // */
  469. // processData: false,
  470. // success: function (result) {
  471. // document.getElementById(
  472. // "upFile"
  473. // ).outerHTML = document.getElementById(
  474. // "upFile"
  475. // ).outerHTML;
  476. // $("#upFile").change(function () {
  477. // upload();
  478. // });
  479. // var r = $.parseJSON(result);
  480. // if (r.state.toLowerCase() == "success") {
  481. // $(".fjnr").text(r.data[0].F_FileName);
  482. // var a = r.data;
  483. // $(a).each(function (i, n) {
  484. // var strs =
  485. // '<span class="files" fiel-num="' +
  486. // n.F_FileId +
  487. // '">' +
  488. // n.F_FileName.substring(19) +
  489. // '<i class="fa fa-remove del_file"></i></span>';
  490. // $(strs)
  491. // .appendTo($(".fileBox"))
  492. // .find(".del_file")
  493. // .click(function (event) {
  494. // event.stopPropagation();
  495. // $(this).parent().remove();
  496. // file_num();
  497. // });
  498. // });
  499. // file_num();
  500. // }
  501. // },
  502. // });
  503. // } else {
  504. // layer.msg("格式不正确");
  505. // }
  506. // } else {
  507. // layer.confirm("请上传文件!", {
  508. // btn: ["确定"],
  509. // });
  510. // }
  511. // }
  512. // //上传文件隐藏域值
  513. // function file_num() {
  514. // var str = "";
  515. // var Str;
  516. // $(".fileBox .files").each(function (j, m) {
  517. // var aa = $(m).attr("fiel-num");
  518. // console.log(aa);
  519. // str += aa + ",";
  520. // Str =
  521. // str.substring(str.length - 1) == "," ?
  522. // str.substring(0, str.length - 1) :
  523. // str;
  524. // });
  525. // $("#file").val(Str);
  526. // }
  527. // 处理结果判断
  528. function isProResultJudge(isProResultdata) {
  529. if (isProResultdata === "1") {
  530. // if (isProtect === "1") {
  531. // $(".prosituation-wrapper").hide(); //处理方案/进程
  532. // $(".annotation-wrapper").hide(); //注释
  533. // $(".connecttime-wrapper").hide(); //沟通时间
  534. // $(".connectmode-wrapper").hide(); //沟通方式
  535. // // $(".replycontent-wrapper").hide(); //答复内容
  536. // $(".isstaisfied-wrapper").show(); //是否满意
  537. // $(".dealWithRemark-wrapper").hide(); // 已办未果备注
  538. // } else if (isProtect === "0") {
  539. $(".prosituation-wrapper").hide(); //处理方案/进程
  540. $(".annotation-wrapper").hide(); //注释
  541. $(".connecttime-wrapper").hide(); //沟通时间
  542. $(".connectmode-wrapper").hide(); //沟通方式
  543. // $(".replycontent-wrapper").show(); //答复内容
  544. $(".isstaisfied-wrapper").show(); //是否满意
  545. $(".dealWithRemark-wrapper").hide(); // 已办未果备注
  546. // }
  547. } else if (isProResultdata === "2") {
  548. $(".prosituation-wrapper").show(); //处理方案/进程
  549. $(".annotation-wrapper").show(); //注释
  550. $(".connecttime-wrapper").hide(); //沟通时间
  551. $(".connectmode-wrapper").hide(); //沟通方式
  552. // $(".replycontent-wrapper").hide(); //答复内容
  553. $(".isstaisfied-wrapper").hide(); //是否满意
  554. $(".dealWithRemark-wrapper").show(); // 已办未果备注
  555. } else if (isProResultdata === "0") {
  556. $(".prosituation-wrapper").hide(); //处理方案/进程
  557. $(".annotation-wrapper").hide(); //注释
  558. $(".connecttime-wrapper").hide(); //沟通时间
  559. $(".connectmode-wrapper").hide(); //沟通方式
  560. // $(".replycontent-wrapper").show(); //答复内容
  561. $(".isstaisfied-wrapper").hide(); //是否满意
  562. $(".dealWithRemark-wrapper").hide(); // 已办未果备注
  563. }
  564. }
  565. //简易版工单详情
  566. function simpleDetail() {
  567. $.getJSON(
  568. huayi.config.callcenter_url + "WorkOrder/GetWorkorderSimp", {
  569. workorderid: wid,
  570. token: $.cookie("token"),
  571. },
  572. function (result) {
  573. if (result.state.toLowerCase() == "success") {
  574. var data = result.data[0];
  575. // var date = (new Date(data.F_CreateTime)).getTime();
  576. var date = new Date()
  577. var year = date.getFullYear();
  578. var month = date.getMonth();
  579. var day = date.getDate();
  580. var hour = date.getHours();
  581. var minutes = date.getMinutes();
  582. var seconds = date.getSeconds();
  583. month = month + 1;
  584. if (month >= 1 && month <= 9) {
  585. month = "0" + month
  586. }
  587. if (day >= 1 && day <= 9) {
  588. day = "0" + day
  589. }
  590. var daysTime = year + "年" + month + "月" + day + "日 " + hour + "时" + minutes + "分" +
  591. seconds + "秒"
  592. simpleDetailStrStart =
  593. data.deptname +
  594. "于时间(" +
  595. daysTime +
  596. ")回复:"
  597. // data.SourceName +
  598. // "来源工单(编号:" +
  599. // data.F_WorkOrderId +
  600. // ")反映" +
  601. // data.F_ComTitle +
  602. // "问题,";
  603. $("#situation").val(simpleDetailStrStart);
  604. }
  605. }
  606. );
  607. }
  608. function getHistoryList() {
  609. $("#dealmanList").empty()
  610. $.ajax({
  611. type: "get",
  612. url: huayi.config.callcenter_url + "History/GetList",
  613. async: true,
  614. dataType: "json",
  615. data: {
  616. name: "contractor",
  617. token: $.cookie("token"),
  618. },
  619. success: function (res) {
  620. if (res.state == "success") {
  621. $.each(res.data, function (index, val) {
  622. console.log("val", val)
  623. if (val.F_Count !== "") {
  624. var data = JSON.parse(val.F_Count)
  625. console.log("data", data)
  626. $("#dealmanList").append("<option value='" + data.name +
  627. "'data-contact='" + data.contact + "'data-job='" + data
  628. .job + "'>")
  629. }
  630. })
  631. $("#dealmanList").append("<option value='清除历史记录'>")
  632. } else {
  633. layer.confirm(res.message, {
  634. icon: 2,
  635. btn: ['确定']
  636. });
  637. }
  638. }
  639. });
  640. }
  641. $("#dealman").change(function () {
  642. var name = $("#dealman").val()
  643. if (name === "清除历史记录") {
  644. $("#dealman").val("")
  645. deleteHistory()
  646. return
  647. }
  648. $("#dealmanList").find("option").each(function () {
  649. if (name == $(this).val()) {
  650. $("#dealcontact").val($(this).attr("data-contact"))
  651. $("#duties").val($(this).attr("data-job"))
  652. }
  653. })
  654. // $("#dealcontact").attr("data-contact")
  655. // $("#duties").attr("data-job")
  656. })
  657. function addHistory() {
  658. var contractorObject = {
  659. name: $("#dealman").val(),
  660. contact: $("#dealcontact").val(),
  661. job: $("#duties").val(),
  662. }
  663. var contractorObjectStr = JSON.stringify(contractorObject);
  664. $.ajax({
  665. type: "post",
  666. url: huayi.config.callcenter_url + "History/Add",
  667. async: true,
  668. dataType: "json",
  669. data: {
  670. name: "contractor",
  671. count: contractorObjectStr,
  672. token: $.cookie("token"),
  673. },
  674. success: function (res) {
  675. debugger
  676. //var res = $.parseJSON(res)
  677. if (res.state == "success") {
  678. } else {
  679. layer.confirm(res.message, {
  680. icon: 2,
  681. btn: ['确定']
  682. });
  683. }
  684. }
  685. });
  686. }
  687. function deleteHistory() {
  688. $.ajax({
  689. type: "post",
  690. url: huayi.config.callcenter_url + "History/Delete",
  691. async: true,
  692. dataType: "json",
  693. data: {
  694. type: 1,
  695. token: $.cookie("token"),
  696. },
  697. success: function (res) {
  698. if (res.state == "success") {
  699. getHistoryList()
  700. } else {
  701. }
  702. }
  703. });
  704. }
  705. </script>
  706. </body>
  707. </html>