Нет описания

add.html 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  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" href="../js/select2/css/select2.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. </style>
  172. </head>
  173. <body>
  174. <form class="container-fluid" enctype="multipart/form-data">
  175. <div class="page-title">
  176. 添加任务
  177. </div>
  178. <hr />
  179. <div class="row-fluid clearfix">
  180. <div class="bjleft col-md-6">
  181. <div class="bj-title">
  182. <i class="fa fa-user"></i> 基本信息
  183. </div>
  184. <div class="bjCon">
  185. <table style="width: 100%;">
  186. <tr>
  187. <th>任务名称:</th>
  188. <td><input type="text" class="taskName" name="name" /><span>(必填)</span></td>
  189. </tr>
  190. <tr>
  191. <th>任务所属:</th>
  192. <td>
  193. <select name="deptid" id="department" class="x-color select usercode"></select><span>(必填)</span>
  194. </td>
  195. </tr>
  196. <tr>
  197. <th>问卷设置:</th>
  198. <td>
  199. <select name="pagerid" id="pager"></select><span>(必填)</span>
  200. </td>
  201. </tr>
  202. <tr>
  203. <th>计划页面设置:</th>
  204. <td>
  205. <a class="fa fa-pencil " id='Plan'>设置</a>
  206. </td>
  207. </tr>
  208. <tr>
  209. <th>被叫号码:</th>
  210. <td>
  211. <button class="btns set_called" style="padding: 3px 10px;" type="button"><i class="fa fa-wrench" style="margin-right: 5px;"></i>设置</button>
  212. <span class="drfs" style="background-color: #ed4e2a;font-size: 12px;padding: 0 3px;margin-left: 5px;color: #fff;"></span>
  213. <input type="hidden" name="importtype" value="" id="importtype" />
  214. <input type="hidden" name="type" value="1" id="type" />
  215. </td>
  216. </tr>
  217. </table>
  218. <br />
  219. <br />
  220. </div>
  221. </div>
  222. </div>
  223. <input type="hidden" name="tempid" value="" id="tempid" />
  224. <input type="hidden" name="token" value="" id="token" />
  225. <p style="text-align: center; padding: 20px 0;">
  226. <button class="btns sureCun" type="button">保存</button>
  227. <button class="btns return" type="button">取消</button>
  228. </p>
  229. <!--设置被叫号码-->
  230. <div class="model addCall">
  231. <div class="box">
  232. <div class="btop clearfix">
  233. <p class="btl">设置被叫号码</p>
  234. <p class="btr addcbtr"><i class="fa fa-remove"></i></p>
  235. </div>
  236. <div class="boxCon">
  237. <ul class="nav nav-tabs" role="tablist">
  238. <li class="active"><a href="#import_from_file" role="tab" data-toggle="tab"><i class="fa fa-file"></i>文件导入</a></li>
  239. <li><a href="#import_from_hmd" role="tab" data-toggle="tab"><i class="fa fa-table"></i>号段</a></li>
  240. <li><a href="#import_from_telnos" role="tab" data-toggle="tab"><i class="fa fa-reorder"></i>号码列表</a></li>
  241. <li><a href="#import_from_excel" role="tab" data-toggle="tab"><i class="fa fa-file"></i>EXCEL导入</a></li>
  242. <!--<li><a href="#import_from_excel" role="tab" data-toggle="tab"><i class="fa fa-sticky-note"></i>Excel导入</a></li>-->
  243. </ul>
  244. <div class="tab-content">
  245. <div class="tab-pane fade active in" id="import_from_file">
  246. <br />
  247. 支持的文本文件格式,每行一个号码,最多10万个号码:
  248. <br />
  249. <br />
  250. <input type="file" name="fileField" id="fileField" placeholder="号码列表" />
  251. </div>
  252. <div class="tab-pane fade" id="import_from_hmd">
  253. <br />
  254. 支持的文本文件格式,每行一个号码,最多10万个号码:
  255. <br />
  256. <br />
  257. <textarea class="haoDuan" name="phonestr" rows="7" style="width: 100%; resize: none;"></textarea>
  258. </div>
  259. <div class="tab-pane fade" id="import_from_telnos">
  260. <br />
  261. 每行一个号码,最多支持5万个号码:
  262. <br />
  263. <br />
  264. <textarea class="haomaList" name="phonelist" rows="7" style="width: 100%;resize: none;"></textarea>
  265. </div>
  266. <div class="tab-pane fade in" id="import_from_excel">
  267. <br />
  268. 支持的excel文件格式,每行一个号码,最多10万个号码:
  269. <br />
  270. <br />
  271. <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" />
  272. <input type="button" value="上传Excel文件" id="upFileExcel" />
  273. <span class="excelName"></span>
  274. <!--周一添加select-->
  275. <div id="select_in">
  276. </div>
  277. <input type="hidden" id="filepath" name="filepath" value="" />
  278. <input type="hidden" id="selectids" name="selectids" value="" />
  279. <table border="1" cellspacing="2" cellpadding="2" bordercolor="#ccc">
  280. <thead>
  281. <tr id="excelHead"></tr>
  282. </thead>
  283. <tbody id="excelBody">
  284. <tr>
  285. <td colspan="3">暂时没有数据,请选择文件加载数据。</td>
  286. </tr>
  287. </tbody>
  288. </table>
  289. </div>
  290. </div>
  291. <div class="check" style="text-align: left;padding-left: 25px;">
  292. <div class="checkbox checkbox-warning checkbox-inline">
  293. <input id="ag" type="checkbox" name="checkfilter1">
  294. <label for="ag">过滤Excel中重复号码</label>
  295. </div>
  296. <div class="checkbox checkbox-warning checkbox-inline">
  297. <input id="nag" type="checkbox" name="checkfilter2">
  298. <label for="nag">过滤三个月内外呼回访的号码</label>
  299. </div>
  300. </div>
  301. <div style="text-align: right;"><button class="btns queren" type="button">确认</button></div>
  302. </div>
  303. </div>
  304. </div>
  305. </form>
  306. <script src="../js/jquery-ui.js"></script>
  307. <script src="../js/timePicker.js"></script>
  308. <!--<script src="../js/ajaxfileupload.js"></script>-->
  309. <script src="../js/jquery.form.min.js"></script>
  310. <script src="../js/select2/js/select2.min.js"></script>
  311. <script>
  312. var token = $.cookie("token");
  313. $('#token').val(token);
  314. var ImportType;//号码导入方式
  315. var haoma;
  316. $(document).ready(function () {
  317. $.ajax({
  318. type: "get",
  319. url: huayi.config.callcenter_url + "Questionnaire/GetAllPagerInfo",
  320. async: true,
  321. dataType: 'json',
  322. data: {
  323. token: token
  324. },
  325. success: function (data) {
  326. var con = data.data;
  327. $('#pager').append('<option value="0">请选择</option>');
  328. $(con).each(function (i, n) {
  329. $('#pager').append('<option value="' + n.id + '">' + n.name + '</option>');
  330. })
  331. }
  332. });
  333. //部门下拉数据
  334. $("#department").select2({
  335. width: 'resolve',
  336. minimumResultsForSearch: -1,
  337. ajax: {
  338. type: "get",
  339. url: huayi.config.callcenter_url + "Department/GetDeptListForReport",
  340. async: true,
  341. dataType: "json",
  342. data: function (params) {
  343. return {
  344. token: $.cookie("token"),
  345. pid: params.id,
  346. text: "当前用户所属部门"
  347. }
  348. },
  349. processResults: function (data) {
  350. return {
  351. results: data.data
  352. }
  353. },
  354. cache: true
  355. },
  356. placeholder: "请选择",
  357. });
  358. });
  359. $('.set_called').click(function () {
  360. $('.addCall').show()
  361. })
  362. $('.addcbtr').click(function () {
  363. $('.addCall').hide();
  364. })
  365. $('.sureCun').click(function () {
  366. if ($('.taskName').val() == '') {
  367. layer.confirm('请输入任务名称!', {
  368. btn: ['确定']
  369. });
  370. return;
  371. } else {
  372. $(".container-fluid")
  373. .attr("method", "post")
  374. .attr("action", huayi.config.callcenter_url + "CallPlan/CreateOrUpdate")
  375. .attr("enctype", "multipart/form-data");
  376. $(".container-fluid").ajaxSubmit({
  377. dataType: "json",
  378. success: function (res) {
  379. if (res.state == "success") {
  380. top.$("iframe:visible")[0].src = "clickcall/callplanlist.html?token=" + token;
  381. } else {
  382. layer.msg(res.message);
  383. }
  384. }
  385. });
  386. }
  387. })
  388. $('.return').click(function () {
  389. top.$("iframe:visible")[0].src = "clickcall/callplanlist.html";
  390. })
  391. $('.queren').click(function () {
  392. $('.drfs').show();
  393. if ($('#import_from_file').hasClass('active')) {
  394. ImportType = 1;//文件导入
  395. $('.drfs').html('选择从文件导入');
  396. } else if ($('#import_from_hmd').hasClass('active')) {
  397. ImportType = 3;//号段导入
  398. haoma = $('.haoDuan').val();
  399. $('.drfs').html('选择从号段导入');
  400. } else if ($('#import_from_telnos').hasClass('active')) {
  401. ImportType = 2;//号码列表导入
  402. haoma = $('.haomaList').val();
  403. $('.drfs').html('选择从号码列表导入');
  404. } else if ($('#import_from_excel').hasClass('active')) {
  405. ImportType = 4;//文件导入
  406. $('.drfs').html('选择从EXCEL文件导入');
  407. }
  408. console.log(ImportType);
  409. $("#importtype").val(ImportType);
  410. $('.addCall').hide();
  411. })
  412. //上传EXCEL文件
  413. $("#upFileExcel").click(function () {
  414. $("#fileExcel").trigger("click")
  415. .change(function () {
  416. upload();
  417. });
  418. });
  419. //上传文件
  420. function upload() {
  421. var Files = document.getElementById("fileExcel").files;
  422. if (Files.length > 0) {
  423. var formData = new FormData();
  424. for (var i = 0; i < Files.length; i++) {
  425. formData.append('file' + i, Files[i]);
  426. }
  427. formData.append("token", $.cookie("token"));
  428. $.ajax({
  429. url: huayi.config.callcenter_url + "/CallPlan/ImportData",
  430. type: "POST",
  431. data: formData,
  432. /**
  433. *必须false才会自动加上正确的Content-Type
  434. */
  435. contentType: false,
  436. /**
  437. * 必须false才会避开jQuery对 formdata 的默认处理
  438. * XMLHttpRequest会对 formdata 进行正确的处理
  439. */
  440. processData: false,
  441. success: function (result) {
  442. document.getElementById("fileExcel").outerHTML = document.getElementById("fileExcel").outerHTML;
  443. $("#fileExcel").change(function () {
  444. upload();
  445. });
  446. var r = $.parseJSON(result);
  447. if (r.state.toLowerCase() == "success") {
  448. var excelData = r.data;
  449. var excelfileName = excelData.filepath;
  450. var selectsLength = excelData.heads.length;
  451. $('#import_from_excel .excelName').html(Files[0].name);//文件名称
  452. $('#filepath').val(excelfileName);
  453. getFields(selectsLength);
  454. //加载表头
  455. $('#excelHead').html('');
  456. for (var x = 0; x < selectsLength; x++) {
  457. $('#excelHead').append('<th>' + excelData.heads[x] + '</th>');
  458. $('#noData').css('display', 'none');
  459. }
  460. //加载表格内容
  461. $('#excelBody').html('');
  462. for (var i = 0; i < excelData.items.length; i++) {
  463. var tr = $('<tr></tr>');
  464. $('#excelBody').append(tr);
  465. for (var l = 0; l < selectsLength; l++) {
  466. var excelHtml = '<td>' + excelData.items[i][l] + '</td>';
  467. tr.append(excelHtml);
  468. }
  469. }
  470. }
  471. }
  472. });
  473. } else {
  474. layer.confirm('请上传文件!', {
  475. btn: ['确定']
  476. });
  477. }
  478. }
  479. //获取字段
  480. function getFields(sLength) {
  481. $.getJSON(huayi.config.callcenter_url + "ExcelTmp/GetSelectedList", {
  482. taskid: -1,
  483. tempid: $('#tempid').val(),
  484. "token": token
  485. }, function (result) {
  486. if (result.state.toLowerCase() == "success") {
  487. selectlists = result.data;
  488. if ($(selectlists)) {
  489. //根据表头列数加载字段
  490. $('#select_in').html('');
  491. $('#selectids').val('');
  492. for (var j = 0; j < sLength; j++) {
  493. var jcount = j + 1;
  494. $('#select_in').append('<span><select name="select_' + j + '" id="select_' + j + '" class="select_"></select></span>');
  495. $('#select_in select:eq(' + j + ')').append('<option data-selectId="" value="0">请选择字段' + jcount + '</option>');
  496. }
  497. $(selectlists).each(function (k, selectCon) {
  498. $('#select_in select').append('<option data-selectId="' + selectCon.id + '" value="' + selectCon.name + '">' + selectCon.name + '</option>');
  499. });
  500. var oldVal = "";
  501. $('#select_in select').each(function () {
  502. if ($(this).find("option:selected")) {
  503. var _thisVal = $(this).find('option:selected').val();
  504. oldVal = $(this).attr("old", _thisVal)
  505. $('#select_in select').parent().siblings("span").find("option[value=" + _thisVal + "]").not("option[value=0]").hide()
  506. }
  507. })
  508. $("#select_in select").change(function () {
  509. oldVal = $(this).attr("old");
  510. var _thisVal = $(this).find('option:selected').val();
  511. var id = $(this).attr("id");
  512. $(this).parent().siblings("span").find("option[value=" + _thisVal + "]").not("option[value=0]").hide();
  513. $(this).parent().siblings("span").find("option[value=" + oldVal + "]").show();
  514. $(this).find("option[value=" + oldVal + "]").show();
  515. $(this).attr("old", _thisVal)
  516. var selectids = '';
  517. for (var m = 0; m < sLength; m++) {
  518. var selectid = $("#select_in select:eq(" + m + ")").find('option:selected').attr('data-selectId');
  519. selectids += selectid + ',';
  520. }
  521. $('#selectids').val(selectids.substring(0, selectids.length - 1));
  522. });
  523. }
  524. }
  525. });
  526. }
  527. //编辑页面跳转
  528. $("#Plan").click(function () {
  529. layer.open({
  530. type: 2,
  531. content: "../autoCall/Plan.html?wid=", //iframe的url,no代表不显示滚动条
  532. title: '页面设置',
  533. area: ['75%', '80%'], //宽高
  534. });
  535. })
  536. </script>
  537. </body>
  538. </html>