鑫苑新版本前端代码

WelcomeWords.html 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>黑名单管理</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <script src="../Script/Common/huayi.load.js"></script>
  8. <script src="../Script/Common/huayi.config.js"></script>
  9. <link href="../css/Table/table1.css" rel="stylesheet" />
  10. <link href="../css/init.css" rel="stylesheet" />
  11. <script src="../js/laydate/laydate.js"></script>
  12. <style>
  13. table td {
  14. word-break: break-all;
  15. word-wrap: break-word;
  16. }
  17. .add_time input {
  18. width: 50%;
  19. }
  20. .th-box {
  21. background-color: #ffffff;
  22. }
  23. #settime,#settime{
  24. width: 228px;
  25. }
  26. </style>
  27. </head>
  28. <body class="gray-bg">
  29. <div class="daoHang clearfix">
  30. <div class="dhLeft">
  31. <sapn><i class="syIcon"></i>位置:
  32. <a href="javaScript:;" id="ReIndex">首页</a>&gt;
  33. <a href="javaScript:;">话务管理</a>&gt;
  34. <a href="" style="color: #000;">欢迎词语音管理</a>
  35. </sapn>
  36. </div>
  37. <div class="dhRight">
  38. <a href="#" title="刷新"><i class="fa fa-refresh"></i></a>
  39. </div>
  40. </div>
  41. <div class="wrapper wrapper-content animated fadeInRight">
  42. <div class="th-box">
  43. <div class="form-inline clearfix th-bar">
  44. <div class="form-group time-box">
  45. <i class="tub fa fa-search"></i>
  46. <input type="text" class="form-control" id="KeyWords" placeholder="请输入关键字">
  47. </div>
  48. <div class="form-group time-box">
  49. <select class="form-control" id="itemid">
  50. <option value="">请选择项目id</option>
  51. <option value="0">未启动</option>
  52. <option value="1">启动中</option>
  53. </select>
  54. </div>
  55. <div class="form-group time-box">
  56. <i class="tub fa fa-calendar"></i>
  57. <input type="text" class="form-control" id="settime" placeholder="请选择起止时间">
  58. </div>
  59. <div class="form-group time-box">
  60. <i class="tub fa fa-calendar"></i>
  61. <input type="text" class="form-control" id="settimes" placeholder="请选择有效时间">
  62. </div>
  63. <div class="form-group time-box">
  64. <select class="form-control" id="state">
  65. <option value="">请选择状态</option>
  66. <option value="0">未启动</option>
  67. <option value="1">启动中</option>
  68. </select>
  69. </div>
  70. <div class="form-group pull-right tool_bars">
  71. <input type="button" class="sc_btn" id="sceach_btn" value="搜索" />
  72. <input type="button" class="sc_btn" id="HY_add" onclick="btn_add()" value="添加" />
  73. <input type="button" class="sc_btn" id="HY_edit" onclick="btn_edit()" value="修改" />
  74. <input type="button" class="sc_btn" id="HY_delete" onclick="btn_deletes()" value="删除" />
  75. </div>
  76. </div>
  77. </div>
  78. <div style="width: 100%;padding-top: 10px;">
  79. <table id="list" data-row-style="rowStyle" data-query-params="queryParams" data-pagination="true">
  80. <thead>
  81. <tr>
  82. <th data-field="state" data-checkbox="true"></th>
  83. <th data-field="item">项目名称</th>
  84. <th data-field="path" data-formatter="setCode" data-align="center">录音</th>
  85. <th data-field="bytime">生效时间</th>
  86. <th data-field="eytime">失效时间</th>
  87. <th data-field="btime">开始时间</th>
  88. <th data-field="etime">结束时间</th>
  89. <th data-field="state" data-formatter="formatterState">状态</th>
  90. <th data-field="remark" data-formatter="formatterRemark">备注</th>
  91. </tr>
  92. </thead>
  93. <tbody id="tbody"></tbody>
  94. </table>
  95. </div>
  96. </div>
  97. <!--下载框-->
  98. <div class="t-shade">
  99. <div class="shade_k">
  100. <div class="shade_title">
  101. <span>录音播放与下载<srong class="cknum"></srong></span>
  102. <span class="setwin"><a>x</a></span>
  103. </div>
  104. <div class="shade_content">
  105. <div class="Ly_box audiojs">
  106. </div>
  107. <div class="boxCon LY_box">
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <script>
  113. $(document).ready(function() {
  114. laydate.render({
  115. elem: '#settime',
  116. theme: '#1ab394',
  117. calendar: true,
  118. range: '~'
  119. });
  120. laydate.render({
  121. elem: '#settimes',
  122. theme: '#1ab394',
  123. calendar: true,
  124. range: '~'
  125. });
  126. initTable();
  127. /*搜索*/
  128. $("#sceach_btn").click(function() {
  129. initTable();
  130. })
  131. $(".setwin").click(function() {
  132. $(".t-shade").removeClass("cx");
  133. $('audio')[0].pause();
  134. });
  135. })
  136. function initTable() {
  137. //先销毁表格
  138. $('#list').bootstrapTable('destroy');
  139. //初始化表格,动态从服务器加载数据
  140. $("#list").bootstrapTable({
  141. method: "get", //使用get请求到服务器获取数据
  142. url: huayi.config.callcenter_url + "IVRWelcome/GetList", //获取数据的Servlet地址
  143. contentType: 'application/x-www-form-urlencoded',
  144. striped: true, //表格显示条纹
  145. pagination: true, //启动分页
  146. pageSize: 10, //每页显示的记录数
  147. pageNumber: 1, //当前第几页
  148. pageList: [10, 20, 50, 100], //记录数可选列表
  149. search: false, //是否启用查询
  150. showColumns: false, //显示下拉框勾选要显示的列
  151. showRefresh: false, //显示刷新按钮
  152. sidePagination: "server", //表示服务端请求
  153. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  154. //设置为limit可以获取limit, offset, search, sort, order
  155. queryParamsType: "undefined",
  156. queryParams: function queryParams(params) { //设置查询参数
  157. var param = {
  158. page: params.pageNumber,
  159. pagesize: params.pageSize,
  160. key: $("#KeyWords").val(),
  161. itemid: $("#itemid").val(),
  162. btime: $('#settime').val() && $('#settime').val().split(' ~ ')[0],
  163. etime: $('#settime').val() && $('#settime').val().split(' ~ ')[1],
  164. bytime: $('#settimes').val() && $('#settimes').val().split(' ~ ')[0],
  165. eytime: $('#settimes').val() && $('#settimes').val().split(' ~ ')[1],
  166. state:$('#state').val(),
  167. token: $.cookie("token")
  168. };
  169. return param;
  170. },
  171. onLoadSuccess: function() { //加载成功时执行
  172. //layer.msg("加载成功");
  173. },
  174. onLoadError: function() { //加载失败时执行
  175. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  176. }
  177. });
  178. }
  179. /*删除提示*/
  180. function btn_deletes(){
  181. var ids = $.map($('#list').bootstrapTable('getSelections'),
  182. function(row) {
  183. return row.id;
  184. });
  185. /*判断长度*/
  186. if(ids.length <= 0) {
  187. layer.confirm('没有可删除的选项?', {
  188. btn: ['确定'] //按钮
  189. });
  190. return;
  191. }
  192. removes();
  193. }
  194. function removes() {
  195. layer.confirm('确定删除当前记录?', {
  196. btn: ['是', '否'] //按钮
  197. }, function() {
  198. /*执行删除*/
  199. var ids = $.map($('#list').bootstrapTable('getSelections'),
  200. function(row) {
  201. return row.id;
  202. });
  203. /*发送请求*/
  204. $.post(huayi.config.callcenter_url + "IVRWelcome/DelIVRWords", {
  205. ids: ids,
  206. token: $.cookie("token")
  207. }, function(result) {
  208. result = JSON.parse(result);
  209. if(result.state.toLowerCase() == "success") {
  210. layer.msg("删除成功");
  211. $('#list').bootstrapTable('refresh');
  212. }
  213. })
  214. });
  215. }
  216. //添加
  217. function btn_add(){
  218. layer.open({
  219. type: 2,
  220. content: "addWelcomeWords.html",
  221. title: '添加欢迎词语音',
  222. area: ['75%', '70%'], //宽高
  223. });
  224. }
  225. //修改
  226. function btn_edit(){
  227. var ids = $.map($('#list').bootstrapTable('getSelections'),
  228. function(row) {
  229. return row.id;
  230. });
  231. if(ids.length != 1) {
  232. layer.confirm('请选择一行进行修改?', {
  233. btn: ['确定'] //按钮
  234. });
  235. return;
  236. } else {
  237. layer.open({
  238. type: 2,
  239. content: "addWelcomeWords.html?id="+ids,
  240. title: '修改欢迎词语音',
  241. area: ['75%', '70%'], //宽高
  242. });
  243. }
  244. }
  245. //状态
  246. function formatterState(val,row){
  247. var str="";
  248. if(val==0){
  249. str='未启动'
  250. }else{
  251. str='启动中'
  252. }
  253. return str
  254. }
  255. //备注
  256. function formatterRemark(val){
  257. var str="";
  258. if(val) {
  259. if(val.length > 12) {
  260. str='<div title="'+ val +'">'+val.substring(0, 12) + '...</div>';
  261. }else{
  262. str='<div title="'+ val +'">'+ val + '</div>';
  263. }
  264. return str;
  265. }
  266. }
  267. //音频
  268. function setCode(val) {
  269. if(val) {
  270. return '<div class="imgs">' +
  271. '<img src="../img/vice.png" alt="" onclick= ck(this) item="' + val + '" />' +
  272. '</div>';
  273. } else {
  274. return '';
  275. }
  276. }
  277. //录音
  278. function ck(val) {
  279. // if(!!window.ActiveXObject || "ActiveXObject" in window){
  280. // layer.open({
  281. // type: 1,
  282. // content: htmls,
  283. // title: '录音播放',
  284. // area: ['55%', '65%'], //宽高
  285. // });
  286. // WindowsMediaPlayer.URL=$(val).attr('item');
  287. // $('<a href="' + $(val).attr('item') + '" class="sc_btn LY "download="' + $(val).attr('item') + '">下载录音</a>').appendTo(".xzly");
  288. //
  289. // }else{
  290. var path = $(val).attr("item");
  291. $(".t-shade").addClass("cx");
  292. $(".Ly_box").empty();
  293. $(".LY_box").empty();
  294. $('<audio style="width:100%;"class=" " src="' + path + '" loop="loop" type="audio/v3" controls="controls"></audio>').appendTo(".Ly_box");
  295. $('<a href="' + path + '" class="sc_btn LY "download="' + path + '">下载录音</a>').appendTo(".LY_box");
  296. // }
  297. }
  298. </script>
  299. </body>
  300. </html>