Sin descripción

add.html 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  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.http.js"></script>
  7. <script src="../Script/Common/huayi.config.js"></script>
  8. <link rel="stylesheet" href="../css/jquery-ui.css" />
  9. <link rel="stylesheet" href="../css/tpkerjqui.css" />
  10. <link rel="stylesheet" href="../css/timePicker.css" />
  11. <link rel="stylesheet" href="../css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css">
  12. <link rel="stylesheet" href="../css/stty.css" />
  13. <link rel="stylesheet" href="../css/init.css" />
  14. <link rel="stylesheet" type="text/css" href="../js/bootstrap-treeview/bootstrap-treeview.min.css" />
  15. <title>添加任务</title>
  16. <style>
  17. .page-title {
  18. padding: 0px;
  19. font-size: 16px;
  20. font-weight: bold;
  21. letter-spacing: -1px;
  22. display: block;
  23. color: #1570A6;
  24. margin: 20px 0px 15px 0px;
  25. }
  26. hr {
  27. margin: 20px 0;
  28. border: 0;
  29. border-top: 1px solid #E0DFDF;
  30. border-bottom: 1px solid #FEFEFE;
  31. }
  32. .bj-title {
  33. color: #ffffff;
  34. background-color: #1ab394;
  35. padding: 8px 35px 8px 14px;
  36. text-shadow: 0 1px 0 rgba(179, 142, 142, 0.5);
  37. border: 1px solid #e5e5e5;
  38. }
  39. .bjCon table th {
  40. padding: 5px 8px 5px 0;
  41. text-align: right;
  42. width: 30%;
  43. }
  44. .bjCon table td {
  45. padding: 6px 0 5px 10px;
  46. text-align: left;
  47. color: #717171;
  48. line-height: 200%;
  49. position: relative;
  50. }
  51. .bjCon table td input {
  52. border: 1px solid #e5e5e5;
  53. width: 240px;
  54. outline: 0;
  55. margin-right: 5px;
  56. padding-left: 10px;
  57. }
  58. .bjCon table td select {
  59. width: 240px;
  60. background-color: #ffffff;
  61. background-image: none !important;
  62. filter: none !important;
  63. border: 1px solid #e5e5e5;
  64. outline: none;
  65. height: 34px !important;
  66. line-height: 30px;
  67. margin-right: 5px;
  68. padding-left: 10px;
  69. }
  70. .bjCon {
  71. padding-top: 20px;
  72. border: 1px solid #e5e5e5;
  73. border-top: 0;
  74. }
  75. .bjright table td input {
  76. padding-left: 30px;
  77. }
  78. .tub {
  79. position: absolute;
  80. left: 18px;
  81. top: 13px;
  82. font-size: 18px;
  83. color: #ccc;
  84. }
  85. .ui-datepicker.ui-widget-content {
  86. background: none !important;
  87. background-color: #eee !important;
  88. }
  89. .ui-widget-header .ui-icon {
  90. background-image: url(../img/ui-icons_444444_256x240.png) !important;
  91. }
  92. .box {
  93. width: 55%;
  94. margin: 0 auto;
  95. margin-top: 5%;
  96. }
  97. .box .btop {
  98. height: 35px;
  99. background: #1ab394;
  100. color: #fff;
  101. line-height: 35px;
  102. padding: 0 15px;
  103. /* margin-bottom: 15px; */
  104. }
  105. .btl {
  106. float: left;
  107. margin: 0;
  108. }
  109. .btr {
  110. float: right;
  111. margin: 0;
  112. cursor: pointer;
  113. }
  114. .boxCon {
  115. width: 100%;
  116. min-height: 400px;
  117. background: #fff;
  118. text-align: center;
  119. padding: 10px 15px;
  120. height: auto;
  121. overflow-y: scroll;
  122. }
  123. .model {
  124. position: fixed;
  125. top: 0;
  126. right: 0;
  127. bottom: 0;
  128. left: 0;
  129. height: 100%;
  130. width: 100%;
  131. background: rgba(0, 0, 0, 0.48);
  132. z-index: 100;
  133. display: none;
  134. }
  135. .tab-content {
  136. text-align: left;
  137. height: 260px;
  138. overflow-y: auto;
  139. }
  140. .checkbox label {
  141. padding-right: 15px;
  142. }
  143. .drfs {
  144. display: none;
  145. }
  146. #import_from_excel table {
  147. margin: 20px auto;
  148. width: 100%;
  149. text-align: center;
  150. }
  151. #import_from_excel table thead th,
  152. #import_from_excel table tbody td {
  153. text-align: center;
  154. }
  155. .select_ {
  156. width: 150px;
  157. background-color: #FFF;
  158. background-image: none;
  159. border: 1px solid #ccc;
  160. border-radius: 1px;
  161. color: inherit;
  162. padding: 6px 12px;
  163. outline: none;
  164. vertical-align: middle;
  165. margin-top: 20px;
  166. margin-right: 20px;
  167. }
  168. #import_from_excel table thead th {
  169. width: 10%;
  170. }
  171. .drop_down {
  172. position: relative;
  173. }
  174. .caret {
  175. margin: 0 7px 0 -23px;
  176. }
  177. #deptTreeView {
  178. width: 360px;
  179. max-height: 256px;
  180. overflow-y: auto;
  181. position: absolute;
  182. z-index: 2;
  183. top: 30px;
  184. left: 0px;
  185. background-color: #fff;
  186. }
  187. </style>
  188. </head>
  189. <body>
  190. <form class="container-fluid" enctype="multipart/form-data">
  191. <div class="page-title">
  192. 添加任务
  193. </div>
  194. <hr />
  195. <div class="row-fluid clearfix">
  196. <div class="bjleft col-md-6">
  197. <div class="bj-title">
  198. <i class="fa fa-user"></i> 基本信息
  199. </div>
  200. <div class="bjCon">
  201. <table style="width: 100%;">
  202. <tr>
  203. <th>任务名称:</th>
  204. <td><input type="text" class="taskName" name="name" /><span>(必填)</span></td>
  205. </tr>
  206. <tr>
  207. <th>任务所属:</th>
  208. <td>
  209. <div class="drop_down">
  210. <input type="text" class="" id="department" data-id="-1" placeholder="请选择部门" />
  211. <span class="caret"></span>
  212. <span>(必填)</span>
  213. <div id="deptTreeView" class="hidden"></div>
  214. </div>
  215. </td>
  216. </tr>
  217. <tr>
  218. <th>问卷设置:</th>
  219. <td>
  220. <select name="pagerid" id="pager"></select><span>(必填)</span>
  221. </td>
  222. </tr>
  223. <tr>
  224. <th>计划页面设置:</th>
  225. <td>
  226. <a class="fa fa-pencil " id='Plan'>设置</a>
  227. </td>
  228. </tr>
  229. <tr>
  230. <th>被叫号码:</th>
  231. <td>
  232. <button class="btns set_called" style="padding: 3px 10px;" type="button"><i class="fa fa-wrench" style="margin-right: 5px;"></i>设置</button>
  233. <span class="drfs" style="background-color: #ed4e2a;font-size: 12px;padding: 0 3px;margin-left: 5px;color: #fff;"></span>
  234. <input type="hidden" name="importtype" value="" id="importtype" />
  235. <input type="hidden" name="type" value="1" id="type" />
  236. </td>
  237. </tr>
  238. </table>
  239. <br />
  240. <br />
  241. </div>
  242. </div>
  243. </div>
  244. <input type="hidden" name="tempid" value="" id="tempid" />
  245. <input type="hidden" name="token" value="" id="token" />
  246. <p style="text-align: center; padding: 20px 0;">
  247. <button class="btns sureCun" type="button">保存</button>
  248. <button class="btns return" type="button">取消</button>
  249. </p>
  250. <!--设置被叫号码-->
  251. <div class="model addCall">
  252. <div class="box">
  253. <div class="btop clearfix">
  254. <p class="btl">设置被叫号码</p>
  255. <p class="btr addcbtr"><i class="fa fa-remove"></i></p>
  256. </div>
  257. <div class="boxCon">
  258. <ul class="nav nav-tabs" role="tablist">
  259. <li class="active">
  260. <a href="#import_from_file" role="tab" data-toggle="tab"><i class="fa fa-file"></i>文件导入</a>
  261. </li>
  262. <li>
  263. <a href="#import_from_hmd" role="tab" data-toggle="tab"><i class="fa fa-table"></i>号段</a>
  264. </li>
  265. <li>
  266. <a href="#import_from_telnos" role="tab" data-toggle="tab"><i class="fa fa-reorder"></i>号码列表</a>
  267. </li>
  268. <li>
  269. <a href="#import_from_excel" role="tab" data-toggle="tab"><i class="fa fa-file"></i>EXCEL导入</a>
  270. </li>
  271. <!--<li><a href="#import_from_excel" role="tab" data-toggle="tab"><i class="fa fa-sticky-note"></i>Excel导入</a></li>-->
  272. </ul>
  273. <div class="tab-content">
  274. <div class="tab-pane fade active in" id="import_from_file">
  275. <br /> 支持的文本文件格式,每行一个号码,最多10万个号码:
  276. <br />
  277. <br />
  278. <input type="file" name="fileField" id="fileField" placeholder="号码列表" />
  279. </div>
  280. <div class="tab-pane fade" id="import_from_hmd">
  281. <br /> 支持的文本文件格式,每行一个号码,最多10万个号码:
  282. <br />
  283. <br />
  284. <textarea class="haoDuan" name="phonestr" rows="7" style="width: 100%; resize: none;"></textarea>
  285. </div>
  286. <div class="tab-pane fade" id="import_from_telnos">
  287. <br /> 每行一个号码,最多支持5万个号码:
  288. <br />
  289. <br />
  290. <textarea class="haomaList" name="phonelist" rows="7" style="width: 100%;resize: none;"></textarea>
  291. </div>
  292. <div class="tab-pane fade in" id="import_from_excel">
  293. <br /> 支持的excel文件格式,每行一个号码,最多10万个号码:
  294. <br />
  295. <br />
  296. <input type="file" name="fileExcel" id="fileExcel" style="display: none;" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/x-xls,application/x-xlsx" />
  297. <input type="button" value="上传Excel文件" id="upFileExcel" />
  298. <span class="excelName"></span>
  299. <!--周一添加select-->
  300. <div id="select_in">
  301. </div>
  302. <input type="hidden" id="filepath" name="filepath" value="" />
  303. <input type="hidden" id="selectids" name="selectids" value="" />
  304. <table border="1" cellspacing="2" cellpadding="2" bordercolor="#ccc">
  305. <thead>
  306. <tr id="excelHead"></tr>
  307. </thead>
  308. <tbody id="excelBody">
  309. <tr>
  310. <td colspan="3">暂时没有数据,请选择文件加载数据。</td>
  311. </tr>
  312. </tbody>
  313. </table>
  314. <div style="width: 50%;margin: 0 auto;position: absolute;top: 50%;left: 25%;display: none;" class="barr">
  315. <div class="progress">
  316. <div class="progress-bar progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
  317. <!--<span class="sr-only">100% Complete</span>-->
  318. 正在导入,请稍后...
  319. </div>
  320. </div>
  321. </div>
  322. </div>
  323. </div>
  324. <div class="check" style="text-align: left;padding-left: 25px;">
  325. <div class="checkbox checkbox-warning checkbox-inline">
  326. <input id="ag" type="checkbox" name="checkfilter1">
  327. <label for="ag">过滤Excel中重复号码</label>
  328. </div>
  329. <div class="checkbox checkbox-warning checkbox-inline">
  330. <input id="nag" type="checkbox" name="checkfilter2">
  331. <label for="nag">过滤三个月内外呼回访的号码</label>
  332. </div>
  333. </div>
  334. <div style="text-align: right;"><button class="btns queren" type="button">确认</button></div>
  335. </div>
  336. </div>
  337. </div>
  338. </form>
  339. <script src="../js/jquery-ui.js"></script>
  340. <script src="../js/timePicker.js"></script>
  341. <!--<script src="../js/ajaxfileupload.js"></script>-->
  342. <script src="../js/jquery.form.min.js"></script>
  343. <script src="../js/bootstrap-treeview/bootstrap-treeview.min.js"></script>
  344. <script>
  345. var token = $.cookie("token");
  346. $('#token').val(token);
  347. var ImportType; //号码导入方式
  348. var haoma;
  349. $(document).ready(function() {
  350. //部门下拉数据
  351. getDeptLists();
  352. $('#department').on('focus click', function() {
  353. $('#deptTreeView').removeClass('hidden').addClass('show');
  354. });
  355. $('#department').on('keyup', function() {
  356. if($(this).val() == '') {
  357. $('deptTreeView').treeview('uncheckAll', {
  358. silent: true
  359. });
  360. $(this).attr('data-id', '-1');
  361. }
  362. });
  363. $('#department + .caret').on('click', function() {
  364. $('#deptTreeView').removeClass('hidden').addClass('show');
  365. });
  366. $('#deptTreeView').mouseleave(function() {
  367. $(this).removeClass('show').addClass('hidden');
  368. });
  369. $.ajax({
  370. type: "get",
  371. url: huayi.config.callcenter_url + "Questionnaire/GetAllPagerInfo",
  372. async: true,
  373. dataType: 'json',
  374. data: {
  375. token: token
  376. },
  377. success: function(data) {
  378. var con = data.data;
  379. $('#pager').append('<option value="0">请选择</option>');
  380. $(con).each(function(i, n) {
  381. $('#pager').append('<option value="' + n.id + '">' + n.name + '</option>');
  382. })
  383. }
  384. });
  385. //上传EXCEL文件
  386. $("#upFileExcel").click(function() {
  387. $("#fileExcel").trigger("click")
  388. .change(function() {
  389. upload();
  390. });
  391. });
  392. });
  393. $('.set_called').click(function() {
  394. $('.addCall').show()
  395. })
  396. $('.addcbtr').click(function() {
  397. $('.addCall').hide();
  398. })
  399. $('.sureCun').click(function() {
  400. if($('.taskName').val() == '') {
  401. layer.confirm('请输入任务名称!', {
  402. btn: ['确定']
  403. });
  404. return;
  405. } else {
  406. $(".container-fluid")
  407. .attr("method", "post")
  408. .attr("action", huayi.config.callcenter_url + "CallPlan/CreateOrUpdate")
  409. .attr("enctype", "multipart/form-data");
  410. $(".container-fluid").ajaxSubmit({
  411. dataType: "json",
  412. data: {
  413. deptid: $("#department").attr('data-id'),
  414. token: token
  415. },
  416. success: function(res) {
  417. if(res.state == "success") {
  418. top.$("iframe:visible")[0].src = "clickcall/callplanlist.html";
  419. } else {
  420. layer.msg(res.message);
  421. }
  422. }
  423. });
  424. }
  425. })
  426. $('.return').click(function() {
  427. top.$("iframe:visible")[0].src = "clickcall/callplanlist.html";
  428. })
  429. $('.queren').click(function() {
  430. $('.drfs').show();
  431. if($('#import_from_file').hasClass('active')) {
  432. ImportType = 1; //文件导入
  433. $('.drfs').html('选择从文件导入');
  434. } else if($('#import_from_hmd').hasClass('active')) {
  435. ImportType = 3; //号段导入
  436. haoma = $('.haoDuan').val();
  437. $('.drfs').html('选择从号段导入');
  438. } else if($('#import_from_telnos').hasClass('active')) {
  439. ImportType = 2; //号码列表导入
  440. haoma = $('.haomaList').val();
  441. $('.drfs').html('选择从号码列表导入');
  442. } else if($('#import_from_excel').hasClass('active')) {
  443. ImportType = 4; //文件导入
  444. $('.drfs').html('选择从EXCEL文件导入');
  445. }
  446. console.log(ImportType);
  447. $("#importtype").val(ImportType);
  448. $('.addCall').hide();
  449. })
  450. //上传文件
  451. function upload() {
  452. var Files = document.getElementById("fileExcel").files;
  453. if(Files.length > 0) {
  454. var formData = new FormData();
  455. for(var i = 0; i < Files.length; i++) {
  456. formData.append('file' + i, Files[i]);
  457. }
  458. formData.append("token", $.cookie("token"));
  459. $.ajax({
  460. url: huayi.config.callcenter_url + "/CallPlan/ImportData",
  461. type: "POST",
  462. data: formData,
  463. /**
  464. *必须false才会自动加上正确的Content-Type
  465. */
  466. contentType: false,
  467. /**
  468. * 必须false才会避开jQuery对 formdata 的默认处理
  469. * XMLHttpRequest会对 formdata 进行正确的处理
  470. */
  471. processData: false,
  472. beforeSend: function() {
  473. $('.barr').show();
  474. },
  475. success: function(result) {
  476. document.getElementById("fileExcel").outerHTML = document.getElementById("fileExcel").outerHTML;
  477. $("#fileExcel").change(function() {
  478. upload();
  479. });
  480. var r = $.parseJSON(result);
  481. if(r.state.toLowerCase() == "success") {
  482. $('.barr').hide();
  483. var excelData = r.data;
  484. var excelfileName = excelData.filepath;
  485. var selectsLength = excelData.heads.length;
  486. $('#import_from_excel .excelName').html(Files[0].name); //文件名称
  487. $('#filepath').val(excelfileName);
  488. getFields(selectsLength);
  489. //加载表头
  490. $('#excelHead').html('');
  491. for(var x = 0; x < selectsLength; x++) {
  492. $('#excelHead').append('<th>' + excelData.heads[x] + '</th>');
  493. $('#noData').css('display', 'none');
  494. }
  495. //加载表格内容
  496. $('#excelBody').html('');
  497. for(var i = 0; i < excelData.items.length; i++) {
  498. var tr = $('<tr></tr>');
  499. $('#excelBody').append(tr);
  500. for(var l = 0; l < selectsLength; l++) {
  501. var excelHtml = '<td>' + excelData.items[i][l] + '</td>';
  502. tr.append(excelHtml);
  503. }
  504. }
  505. }
  506. }
  507. });
  508. } else {
  509. layer.confirm('请上传文件!', {
  510. btn: ['确定']
  511. });
  512. }
  513. }
  514. //获取字段
  515. function getFields(sLength) {
  516. $.getJSON(huayi.config.callcenter_url + "ExcelTmp/GetSelectedList", {
  517. taskid: -1,
  518. tempid: $('#tempid').val(),
  519. "token": token
  520. }, function(result) {
  521. if(result.state.toLowerCase() == "success") {
  522. selectlists = result.data;
  523. if($(selectlists)) {
  524. //根据表头列数加载字段
  525. $('#select_in').html('');
  526. $('#selectids').val('');
  527. for(var j = 0; j < sLength; j++) {
  528. var jcount = j + 1;
  529. $('#select_in').append('<span><select name="select_' + j + '" id="select_' + j + '" class="select_"></select></span>');
  530. $('#select_in select:eq(' + j + ')').append('<option data-selectId="" value="0">请选择字段' + jcount + '</option>');
  531. }
  532. $(selectlists).each(function(k, selectCon) {
  533. $('#select_in select').append('<option data-selectId="' + selectCon.id + '" value="' + selectCon.name + '">' + selectCon.name + '</option>');
  534. });
  535. var oldVal = "";
  536. $('#select_in select').each(function() {
  537. if($(this).find("option:selected")) {
  538. var _thisVal = $(this).find('option:selected').val();
  539. oldVal = $(this).attr("old", _thisVal)
  540. $('#select_in select').parent().siblings("span").find("option[value=" + _thisVal + "]").not("option[value=0]").hide()
  541. }
  542. })
  543. $("#select_in select").change(function() {
  544. oldVal = $(this).attr("old");
  545. var _thisVal = $(this).find('option:selected').val();
  546. var id = $(this).attr("id");
  547. $(this).parent().siblings("span").find("option[value=" + _thisVal + "]").not("option[value=0]").hide();
  548. $(this).parent().siblings("span").find("option[value=" + oldVal + "]").show();
  549. $(this).find("option[value=" + oldVal + "]").show();
  550. $(this).attr("old", _thisVal)
  551. var selectids = '';
  552. for(var m = 0; m < sLength; m++) {
  553. var selectid = $("#select_in select:eq(" + m + ")").find('option:selected').attr('data-selectId');
  554. selectids += selectid + ',';
  555. }
  556. $('#selectids').val(selectids.substring(0, selectids.length - 1));
  557. });
  558. }
  559. }
  560. });
  561. }
  562. //编辑页面跳转
  563. $("#Plan").click(function() {
  564. layer.open({
  565. type: 2,
  566. content: "../hujiaoManger/Plan.html?wid=", //iframe的url,no代表不显示滚动条
  567. title: '页面设置',
  568. area: ['75%', '80%'], //宽高
  569. });
  570. })
  571. //获取部门
  572. function getDeptLists() {
  573. $.getJSON(huayi.config.callcenter_url + 'Department/GetDeptListForReport', {
  574. token: $.cookie("token")
  575. }, function(result) {
  576. //debugger;
  577. if(result.state.toLowerCase() == "success") {
  578. var defaultDatas = result.data;
  579. var $sTree = $('#deptTreeView').treeview({
  580. color: "#428bca",
  581. expandIcon: 'glyphicon glyphicon-chevron-right',
  582. collapseIcon: 'glyphicon glyphicon-chevron-down',
  583. nodeIcon: 'glyphicon glyphicon-bookmark',
  584. data: defaultDatas,
  585. onNodeSelected: function(event, node) {
  586. $sTree.treeview('clearSearch');
  587. $('#department').val(node.text);
  588. $('#department').attr('data-id', node.id);
  589. $('#deptTreeView').removeClass('show').addClass('hidden');
  590. },
  591. onNodeUnselected: function(event, node) {
  592. $('#department').val('');
  593. $('#department').attr('data-id', '-1');
  594. }
  595. });
  596. var findSNodes = function() {
  597. return $sTree.treeview('search', [$('#department').val(), {
  598. ignoreCase: false,
  599. exactMatch: false
  600. }]);
  601. };
  602. $('#department').on('keyup', function(e) {
  603. var selectableNodes = findSNodes();
  604. });
  605. }
  606. })
  607. }
  608. </script>
  609. </body>
  610. </html>