1
0

group_talkskill_label.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. {extend name="public/layout" /} {block name="title"}分类管理{/block} {block name="body"}
  2. <script src="/static/js/jquery.min.js"></script>
  3. <script src="/static/js/echarts.min.js"></script>
  4. <style type="text/css">
  5. html,
  6. body {
  7. display: block;
  8. min-width: 1100px;
  9. }
  10. .layui-fluid {
  11. display: block;
  12. box-shadow: 0 0 4px 0 #B6CADE;
  13. border-radius: 5px;
  14. margin: 15px;
  15. background-color: #ffffff;
  16. height: auto;
  17. }
  18. .layui-form-label{
  19. width: auto;
  20. }
  21. #data_statistics{
  22. /*background: red;*/
  23. width: 100%;
  24. height: 300px;
  25. float: left;
  26. }
  27. .tab_1{
  28. width: 10%;
  29. }
  30. #echartbox_a{
  31. display: block;
  32. width: 40%;
  33. height: 300px;
  34. /*background: red;*/
  35. float: left;
  36. }
  37. #data_statistics_b{
  38. /*background: blue;*/
  39. width: 48%;
  40. height: 300px;
  41. float: left;
  42. }
  43. .all{
  44. width: 100%;
  45. background: red;
  46. }
  47. #echartbox_b{
  48. display: block;
  49. width: 80%;
  50. height: 400px;
  51. margin:0 auto;
  52. }
  53. #data_statistics_c{
  54. width: 80%;
  55. margin:0 auto;
  56. overflow: hidden;
  57. }
  58. #echartbox_c{
  59. display: block;
  60. width: 80%;
  61. height: 400px;
  62. margin:0 auto;
  63. }
  64. #data_statistics_d{
  65. width: 80%;
  66. margin:0 auto;
  67. overflow: hidden;
  68. }
  69. #echartbox_d{
  70. display: block;
  71. width: 80%;
  72. height: 400px;
  73. margin:0 auto;
  74. }
  75. #data_statistics_e{
  76. width: 80%;
  77. margin:0 auto;
  78. overflow: hidden;
  79. }
  80. .layui_fluid1{display: none;}
  81. .layui-nav-tabs-ul{margin-bottom: 10px;}
  82. .layui-nav-tab_li{float:left;padding: 0px 20px;text-align: center;cursor: pointer;line-height: 38px;height: 38px;}
  83. .add-layui-nav-li{background-color: #249efb;color: #fff;white-space: nowrap;text-align: center;font-size: 14px;border-radius: 2px;
  84. }
  85. .layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{border-bottom: 2px solid #249efb !important;}
  86. /*//*/
  87. .layui_fluid1{display: none;}
  88. .layui-nav-tabs-ul{margin-bottom: 10px;padding-bottom:0;border-bottom: 1px solid #e6e6e6;overflow: hidden;}
  89. .layui-nav-tab_li{float:left;padding: 0px 20px;text-align: center;cursor: pointer;line-height: 38px;height: 38px;position: relative;}
  90. .add-layui-nav-li{color: #f3f3f3;;white-space: nowrap;text-align: center;font-size: 14px;border-radius: 2px;}
  91. .layui-bor-b{position: absolute;bottom:0;width:65px;left:50%;transform: translateX(-50%);height: 1px;background: #249efb;}
  92. .layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{border-bottom: 2px solid #249efb !important;}
  93. .layui-bor-b{display: none;}
  94. .add-layui-nav-li .layui-bor-b{display: block !important;}
  95. .layui-title-b{font-size: 20px;font-weight: bold;}
  96. .layui-li-box{padding-bottom: 30px;border-bottom: 1px solid #e6e6e6;}
  97. .woverflow{overflow: hidden;}
  98. .layui-bolu{color:#249efb}
  99. .layui-data-ul{width:100%;}
  100. .layui-data-ul li{float:left;width:33.33%;line-height: 40px;}
  101. .mdt70{margin-top:30px;}
  102. .width33_33{width:33.33%;}
  103. .wleft{float:left;}
  104. .mdt40{margin-top:40px;}
  105. .width80_{width:80%;}
  106. .wauto{margin:0 auto;}
  107. .layui-data-ul-b{height: 126px;overflow-y: auto;}
  108. .layui-data-ul-b li{float:left;width:33.33%;line-height: 30px;}
  109. .layui_box_con{display: none;height: 100%;}
  110. .layadmin-iframe-if{width:100%;height: 100%;position: absolute;top:56px;left:0;}
  111. .layui-p-bt{font-weight:bold;}
  112. .layui_bm{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:70%;}
  113. .layui-data-ul-b li span{display: block;float:left;}
  114. /*热词搜索*/
  115. /* .layui-form-item .layui-inline {
  116. display: block;
  117. float: left;
  118. width: 145px;
  119. height: 38px;
  120. line-height: 38px;
  121. background: #FFFFFF;
  122. margin-right: 16px;
  123. }
  124. .layui-form-item .layui-input-inline {
  125. width: 145px;
  126. height: 38px;
  127. line-height: 38px;
  128. margin-bottom: 0;
  129. }*/
  130. /* .layui-form-item .layui-input-inline .layui-input {
  131. border: 1px solid #9DB6CF;
  132. border-radius: 5px;
  133. }*/
  134. .layui-form-select dl dd.layui-this {
  135. background-color: #249EFB;
  136. }
  137. .layui-form-item div.searchBox {
  138. width: 320px;
  139. background: #FFFFFF;
  140. border: 1px solid #B6CADE;
  141. /* border-radius: 24px; */
  142. height: 38px;
  143. overflow: hidden;
  144. padding-left: 10px;
  145. position: relative;
  146. margin-bottom: 0px;
  147. /* float: right; */
  148. }
  149. .searchBox .inputBox {
  150. width: 240px;
  151. /* float: left; */
  152. height: 36px;
  153. line-height: 36px;
  154. border-width: 0;
  155. }
  156. /* .searchBtn {
  157. position: absolute;
  158. top: 0;
  159. right: 0;
  160. width: 51px;
  161. height: 38px;
  162. background-color: #fff;
  163. }*/
  164. .searchBtn img {
  165. position: absolute;
  166. width: 26px;
  167. top: 6px;
  168. left: 0;
  169. }
  170. .layui-btn.layui-btn-success {
  171. background-color: #009688;
  172. }
  173. .layui-table thead tr,
  174. .layui-table-header {
  175. background-color: #D8E6F1 !important;
  176. }
  177. .layui-btn-primary {
  178. color: #249EFB;
  179. border: 1px solid #249EFB;
  180. }
  181. .layui-btn-primary:hover {
  182. background-color: #E3F7FF;
  183. color: #249EFB;
  184. }
  185. .layui-bor-b {
  186. height: 3px;
  187. background-color: #249EFB;
  188. }
  189. .add-layui-nav-li {
  190. background-color: #249EFB !important;
  191. color: #fff;
  192. }
  193. .layui-tab-title .layui-this:after {
  194. border-bottom: none;
  195. border: none;
  196. }
  197. .layui-nav-tab_li {
  198. background-color: #F2F2F2;
  199. margin: 0px 5px;
  200. }
  201. .layui-btn-xs,.layui-btn-xs:hover {
  202. border: 1px solid #249EFB;
  203. background-color: #fff;
  204. color: #249EFB;
  205. padding: 0px 10px;
  206. }
  207. .layui-btn-danger,.layui-btn-danger:hover{
  208. color: #FF5722;
  209. background-color: #fff;
  210. border: 1px solid #FF5722;
  211. padding: 0px 10px;
  212. }
  213. #data_statistics_b{
  214. border: 1px solid #E4E4E4;
  215. box-sizing: border-box;
  216. padding: 20px;
  217. }
  218. #data_statistics_c,#data_statistics_d,#data_statistics_e {
  219. border: 1px solid #E4E4E4;
  220. padding: 15px;
  221. }
  222. .mt15 {
  223. margin-top: 15px;
  224. }
  225. .goback {
  226. float: left;
  227. margin-right: 20px;
  228. }
  229. .goback a {
  230. color: #269efb;
  231. }
  232. .goback i {
  233. position: relative !important;
  234. }
  235. </style>
  236. <body>
  237. <div class="layui-fluid">
  238. <div class="">
  239. <div class="layui_fluid1" style="display: block;">
  240. <div class="layui-card">
  241. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  242. <div class="layui-form-item">
  243. <div style="float:right;">
  244. <div class="layui-inline">
  245. <label class="layui-form-label">关键词</label>
  246. <div class="layui-input-inline">
  247. <input type="text" id="keyword" name="keyword" placeholder="请输入话术关键词" autocomplete="off" class="layui-input keyword">
  248. </div>
  249. </div>
  250. <div class="layui-inline">
  251. <label class="layui-form-label">场景</label>
  252. <div class="layui-input-inline">
  253. <select name="type" lay-filter="type" id="type">
  254. <option value="">请选择场景</option>
  255. {volist name="type" id="t"}
  256. <option value="{$t.id}">{$t.label_name}</option>
  257. {/volist}
  258. </select>
  259. </div>
  260. </div>
  261. <div class="layui-inline">
  262. <button class="layui-btn layuiadmin-btn-useradmin searchBtn" lay-submit lay-filter="search">
  263. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  264. </button>
  265. </div>
  266. </div>
  267. <div class="layui-inline" style="float: left;">
  268. {eq name="$from" value="add"}
  269. <!-- <button class="layui-btn layuiadmin-btn layui-btn-primary" id="cate_add">添加场景</button> -->
  270. <button class="layui-btn layuiadmin-btn layui-btn-primary" data-type="add">添加话术</button>
  271. <button class="layui-btn layuiadmin-btn layui-btn-primary" data-type="dictionary" id="dictionary">字典管理</button>
  272. <!-- <button class="layui-btn layuiadmin-btn layui-btn-primary" id="importcustomer">导入话术</button> -->
  273. {else/}
  274. <div class="goback">
  275. <a href="{:url('talkskill/groupCompanyTalkskill')}"><i class="layui-icon layui-icon-return"></i>
  276. <span>返回</span>
  277. </a>
  278. </div>
  279. {/eq}
  280. </div>
  281. </div>
  282. </div>
  283. <div class="layui-card-body">
  284. <table id="label-table" lay-filter="label-table"></table>
  285. </div>
  286. </div>
  287. </div>
  288. </div>
  289. </div>
  290. </body>
  291. {/block} {block name="js"}
  292. <script type="text/html" id="table-evidence-action">
  293. <a class="layui-btn layui-btn-xs" lay-event="share">
  294. {eq name="$from" value="add"}
  295. 指派
  296. {else/}
  297. 共享
  298. {/eq}
  299. </a>
  300. {eq name="$from" value="add"}
  301. {{# if(d.show == 0){ }}
  302. <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  303. <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
  304. {{# }else{ }}
  305. <a class="layui-btn layui-btn-xs layui-btn-disabled" style="border: 1px solid #ccc;color: #ccc;">编辑</a>
  306. <a class="layui-btn layui-btn-xs layui-btn-disabled" style="border: 1px solid #ccc;color: #ccc;">删除</a>
  307. {{# } }}
  308. {/eq}
  309. </script>
  310. <script type="text/html" id="label_name">
  311. <a href="{:url('talkskill/groupTalkskillList')}?type={{d.id}}&from={$from}&root_id={$root_id}" lay-event="talkill_list" style="color: #0066CC">{{d.label_name}}</a>
  312. </script>
  313. <script type="text/html" id="shareCompany">
  314. <a href="javascript:void(0)" lay-event="assign_list" style="color: #0066CC"><i class="layui-icon">&#xe633;</i>{{d.shareCompany}}</a>
  315. </script>
  316. <script>
  317. layui.config({
  318. base: '__LAYUI__/',
  319. urlbase: '/sys'
  320. }).extend({
  321. index: 'lib/index'
  322. }).use(['index', 'table', 'element'], function() {
  323. var $ = layui.$,
  324. form = layui.form,
  325. element = layui.element,
  326. table = layui.table;
  327. //添加分类
  328. $('#cate_add').click(function() {
  329. layer.prompt({
  330. title: ['添加', 'color:#333333;background-color:#D8E6F1;'],
  331. value: ''
  332. }, function(value, index) {
  333. if($.trim(value) == '') {
  334. layer.msg('请填写名称', {anim: 6,time: 800});
  335. return false;
  336. }
  337. if($.trim(value).length > 20) {
  338. layer.msg('场景名称超长', {anim: 6,time: 800});
  339. return false;
  340. }
  341. $.ajax({
  342. url: '{:url("talkskill/cate_talkskill_add")}',
  343. type: 'post',
  344. data: {
  345. name: $.trim(value)
  346. },
  347. dataType: 'json',
  348. success: function(res) {
  349. if(res.code === 0) {
  350. layer.msg(res.msg, {anim: 0,time: 800});
  351. //执行重载
  352. table.reload('label-table');
  353. } else {
  354. layer.msg(res.msg, {anim: 6,time: 800});
  355. }
  356. }
  357. });
  358. layer.close(index);
  359. });
  360. });
  361. //字典管理
  362. $('#dictionary').on('click',function(){
  363. layer.open({
  364. type: 2,
  365. title:['字典管理', 'color:#333333;background-color:#D8E6F1;'],
  366. content: '{:url("talkskill/dictionary")}',
  367. resize: false,
  368. area: ['80%', '80%'],
  369. // btn: ['确定', '取消'],
  370. yes: function(index, layero) {
  371. }
  372. });
  373. })
  374. $('#importcustomer').on('click', function () {
  375. layer.open({
  376. type:2,
  377. title:['批量导入话术', 'color:#333333;background-color:#D8E6F1;'],
  378. content:'{:url("talkskill/importing")}',
  379. resize: false,
  380. area:['80%', '80%'],
  381. });
  382. });
  383. var field = {};
  384. form.on('submit(search)', function (data) {
  385. var type = $('#type').val();
  386. var keyword = $('#keyword').val();
  387. field['type'] = type;
  388. field['keyword'] = keyword;
  389. //执行重载
  390. table.reload('label-table', {
  391. where: field
  392. ,page: {curr:1}
  393. });
  394. });
  395. var active = {
  396. add: function() {
  397. layer.open({
  398. type: 2,
  399. title:['话术添加', 'color:#333333;background-color:#D8E6F1;'],
  400. content: '{:url("talkskill/talkskilladd")}',
  401. resize: false,
  402. area: ['80%', '80%'],
  403. btn: ['确定', '取消'],
  404. yes: function(index, layero) {
  405. //点击确认触发 iframe 内容中的按钮提交
  406. var submit = layero.find('iframe').contents().find("#talkskill-submit");
  407. submit.click();
  408. }
  409. });
  410. }
  411. };
  412. //列表
  413. table.render({
  414. elem: '#label-table',
  415. autoSort: false,
  416. url: '{:url("talkskill/groupTalkskillLabel")}?root_id={$root_id}',
  417. cols: [
  418. [{
  419. type: 'numbers',
  420. field: 'id',
  421. width: 80,
  422. title: '序号',
  423. }, {
  424. align: 'center',
  425. title: '场景',
  426. templet: '#label_name'
  427. }, {
  428. field: 'talkill_count',
  429. align: 'center',
  430. title: '话术条数'
  431. }, {
  432. field: 'update_time',
  433. align: 'center',
  434. title: '更新时间'
  435. }, {
  436. align: 'center',
  437. title: '使用店面',
  438. templet: '#shareCompany'
  439. }, {
  440. title: '操作',
  441. width: 240,
  442. align: 'center',
  443. toolbar: '#table-evidence-action'
  444. }]
  445. ],
  446. page: true,
  447. limit: 30,
  448. height: 'full-220',
  449. text: '对不起,加载出现异常!'
  450. });
  451. //监听列表
  452. table.on('tool(label-table)', function(obj) {
  453. var data = obj.data;
  454. if(obj.event === 'delete') {
  455. layer.confirm('确定要删除该场景么?',{title:['信息', 'color:#333333;background-color:#D8E6F1;'],}, function() {
  456. $.get("{:url('talkskill/cate_del')}?type=0&id=" + data.id, function(res) {
  457. if(res.code === 0) {
  458. layer.msg(res.msg, {
  459. anim: 0,time:800
  460. }, function() {
  461. table.reload('label-table');
  462. });
  463. } else {
  464. layer.msg(res.msg, {
  465. anim: 6,time:800
  466. });
  467. }
  468. });
  469. });
  470. } else if(obj.event === 'edit') {
  471. layer.prompt({
  472. title:['编辑', 'color:#333333;background-color:#D8E6F1;'],
  473. value: data.label_name
  474. }, function(value, index) {
  475. if($.trim(value) == data.label_name || $.trim(value) == '') {
  476. layer.msg('请修改名称', {anim: 6,time: 800});
  477. return false;
  478. }
  479. if($.trim(value).length > 20) {
  480. layer.msg('场景名称超长', {anim: 6,time: 800});
  481. return false;
  482. }
  483. $.ajax({
  484. url: '{:url("talkskill/dictionary_ajax_edit")}',
  485. type: 'post',
  486. data: {
  487. id: data.id,
  488. name: $.trim(value),
  489. type:0
  490. },
  491. dataType: 'json',
  492. success: function(res) {
  493. if(res.code === 0) {
  494. layer.msg(res.msg, {anim: 0,time: 800});
  495. //执行重载
  496. table.reload('label-table');
  497. } else {
  498. layer.msg(res.msg, {anim: 6,time: 800});
  499. }
  500. }
  501. });
  502. layer.close(index);
  503. });
  504. } else if(obj.event === 'share') {
  505. layer.open({
  506. type: 2,
  507. title:['指派店面','color:#333333;background-color:#D8E6F1;'],
  508. content: '{:url("talkskill/groupAssign")}?from={$from}&id=' + obj.data.id + '&root_id={$root_id}',
  509. resize: false,
  510. area: ['50%', '72%'],
  511. });
  512. } else if(obj.event === 'assign_list') {
  513. layer.open({
  514. type: 2,
  515. title:['店面名称','color:#333333;background-color:#D8E6F1;'],
  516. content: '{:url("talkskill/groupShareCompany")}?id=' + obj.data.id + '&from={$from}',
  517. resize: false,
  518. area: ['50%', '72%'],
  519. });
  520. }
  521. });
  522. $('.layui-btn.layuiadmin-btn').on('click', function() {
  523. var type = $(this).data('type');
  524. active[type] ? active[type].call(this) : '';
  525. });
  526. });
  527. </script>
  528. {/block}