| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <link rel="stylesheet" href="../css/init.css" />
- <link rel="stylesheet" type="text/css" href="../js/layui/css/layui.css" />
- <title>客户列表</title>
- <style type="text/css">
- body {
- color: #000;
- font-family: 'Open Sans';
- font-size: 13px;
- }
- .m-kuang {
- width: 134px;
- background-color: #ffffff;
- background-image: none !important;
- filter: none !important;
- border: 1px solid #e5e5e5;
- outline: none;
- height: 34px !important;
- line-height: 30px;
- padding: 4px 6px;
- }
- .zt, .cz {
- display: block;
- height: 20px;
- width: 20px;
- margin: 0 auto;
- }
- .zt {
- background: url(../img/bf1.png) no-repeat;
- }
- .cz {
- background: url(../img/sz1.png) no-repeat;
- }
- .jia {
- display: inline-block;
- height: 16px;
- width: 16px;
- background: url(../img/jia.png) no-repeat;
- vertical-align: sub;
- margin-right: 3px;
- }
- .tool {
- margin: 20px 0;
- }
- .searchbox input {
- width: 99%;
- height: 98%;
- border: 0;
- outline: none;
- padding-left: 10px;
- }
- .secon {
- width: 100%;
- height: 34px;
- margin-bottom: 15px;
- }
- .secl {
- width: 65%;
- display: inline-block;
- height: 100%;
- margin: 0;
- border: 1px solid #eee;
- }
- .stb {
- display: block;
- width: 10%;
- background-color: #1ab394;
- background-image: url(../img/sear1.png);
- background-position: center center;
- background-repeat: no-repeat;
- height: 100%;
- float: left;
- border: 0;
- border-top-right-radius: 3px;
- border-bottom-right-radius: 3px;
- }
- .cz_down {
- position: absolute;
- top: 130%;
- left: -42px;
- z-index: 9999;
- display: none;
- float: left;
- list-style: none;
- text-shadow: none;
- margin: 0px;
- background: #fff;
- border: 1px solid #e5e5e5;
- text-align: left;
- padding: 5px;
- }
- .cz_down li > a {
- padding: 6px 0 6px 13px;
- color: #333;
- text-decoration: none;
- display: block;
- clear: both;
- font-weight: normal;
- line-height: 18px;
- white-space: nowrap;
- }
- .cz_down li:hover {
- background: #eee;
- }
- .cz_down .divider {
- height: 1px;
- margin: 9px 1px;
- overflow: hidden;
- background-color: #e5e5e5;
- border-bottom: 1px solid #e5e5e5;
- }
- .ztColor {
- padding: 2px;
- color: #fff;
- }
- .taskName {
- cursor: pointer;
- }
- .ztc {
- background: #fcb322;
- }
- .clw {
- background: #3cc051;
- }
- .clz {
- background: #57b5e3;
- }
- .dzx {
- background: #ed4e2a;
- }
- .ysc {
- background: #ef2e18;
- }
- .layui-layer-title {
- color: #fff !important;
- background: #019587 !important;
- }
- </style>
- </head>
- <body>
- <form class="container-fluid" enctype="multipart/form-data">
- <div class="container-fluid">
- <div class="daoHang clearfix">
- <div class="dhLeft">
- <sapn>
- <i class="syIcon"></i>位置:
- <a id="ReIndex" href="javaScript:;">首页</a>>
- <a href="javaScript:;">客户管理</a>>
- <a href="javaScript:;" style="color: #000;">客户列表</a>
- </sapn>
- </div>
- </div>
- <div class="tcon">
- <div class="tool clearfix">
- <!--<div class="searchbox col-sm-2">
- <div class="secon">
- <b>号码</b>
- <p class="secl"><input type="text" placeholder="号码" class="phone" /></p>
- </div>
- </div>-->
- </div>
- <div class="anniu layui-btn-group demoTable" style="margin: 20px 0;">
- <button class="btns search layui-btn" type="button"><i class="fa fa-search"></i>查询</button>
- <a class="btns layui-btn" id="addto"><i class="fa fa-plus"></i>添加</a>
- <a class="btns layui-btn" id="remove" data-type="getCheckData"><i class="fa fa-remove"></i>批量删除</a>
- </div>
- <table class="layui-hide" id="table1" lay-filter="demo"></table>
- </div>
- </div>
- </form>
- <script type="text/html" id="barDemo">
- <!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>-->
- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
- </script>
- <script src="../js/layui/layui.js"></script>
- <script src="../js/jquery.form.min.js"></script>
- <script>
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Customer/GetSearchFields',
- async: true,
- dataType: 'json',
- data: {
- token: token,
- },
- success: function (res) {
- searchBar = res.data.search;
- //搜索条件
- $('.tool').html('');
- $(searchBar).each(function (k, q) {
- if (q.F_Search > 0) {
- $('<div class="searchbox col-sm-2">' +
- '<div class="secon">' +
- '<b>' + q.F_Name + ':</b>' +
- '<p class="secl"><input type="text" class="phone" name="' + q.F_DBFieldName + '"/></p>' +
- '</div>' +
- '</div>').appendTo('.tool')
- }
- })
- }
- });
- var sear;
- var token = $.cookie("token");
- //搜索功能
- $('.search').click(function () {
- initTable();
- });
- //添加
- $('#addto').click(function () {
- // top.$("iframe:visible")[0].src = "keHuManager/customerListAdd.html";
- layer.open({
- type: 2,
- content: "../keHuManager/customerListAdd.html", //iframe的url,no代表不显示滚动条
- title: '客户列表添加',
- area: ['75%', '80%'], //宽高
- });
- });
- initTable()
- function initTable() {
- var colsData = [];
- var arrData = [];
- $(".container-fluid")
- .attr("method", "get")
- .attr("action", huayi.config.callcenter_url + "Customer/GetSearch")
- .attr("enctype", "multipart/form-data");
- $(".container-fluid").ajaxSubmit({
- dataType: "json",
- data: {
- token: token
- },
- success: function (returnValue) {
- //debugger;
- if (returnValue.state.toLowerCase() == "success") {
- //异步获取数据
- var theadData = returnValue.data.headlist,
- resultData1 = returnValue.data.datalist;
- //加载头部
- $(theadData).each(function (i, n) {
- var obj1 = {};
- obj1['field'] = 'items' + i;
- obj1['title'] = theadData[i];
- colsData.push(obj1);
- })
- colsData.push({ fixed: 'right', align: 'center', toolbar: '#barDemo' });
- colsData.unshift({ checkbox: true, fixed: true });
- //表身数据
- $(resultData1).each(function (j, m) {
- var obj = {};
- obj['id'] = m.id;
- $(m.dataarr).each(function (y, g) {
- obj['items' + y + ''] = g;
- })
- arrData.push(obj);
- })
- layui.use('table', function () {
- var table = layui.table;
- //展示已知数据
- table.render({
- elem: '#table1',
- cols: [colsData],
- data: arrData,
- //skin: 'line', //表格风格
- even: true,
- page: true //是否显示分页
- //,limits: [5, 7, 10]
- //,limit: 5 //每页默认显示的数量
- });
- });
- }
- }
- });
- }
- layui.use('table', function () {
- var table = layui.table;
- //操作
- table.on('tool(demo)', function (obj) {
- console.log(obj)
- var data = obj.data;
- var srr = [];
- // if(obj.event === 'detail'){
- // layer.msg('ID:'+ data.id + ' 的查看操作');
- // } else
- if (obj.event === 'del') {
- layer.confirm('确定删除吗?', function (index) {
- srr.push(data.id);
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + 'Customer/DelCustomer',
- async: true,
- dataType: 'json',
- data: {
- token: token,
- ids: srr
- },
- success: function (res) {
- if (res.state.toLowerCase() == 'success') {
- layer.close(index);
- layer.msg('删除成功!');
- initTable();
- }
- }
- });
- });
- } else if (obj.event === 'edit') {
- layer.open({
- type: 2,
- content: "../keHuManager/customerListEdit.html?id=" + data.id, //iframe的url,no代表不显示滚动条
- title: '客户列表修改',
- area: ['75%', '80%'], //宽高
- });
- // layer.alert('编辑行:<br>'+ JSON.stringify(data))
- }
- });
- //批量删除
- var $ = layui.$, active = {
- getCheckData: function () { //获取选中数据
- var checkStatus = table.checkStatus('table1').data;
- var arr = [];
- $(checkStatus).each(function (k, y) {
- arr.push(y.id)
- })
- if (arr.length <= 0) {
- layer.msg('请选择要删除的行!');
- } else {
- layer.confirm('确定删除吗?', function (index) {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + 'Customer/DelCustomer',
- async: true,
- dataType: 'json',
- data: {
- token: token,
- ids: arr
- },
- success: function (res) {
- if (res.state.toLowerCase() == 'success') {
- layer.close(index);
- layer.msg('删除成功!');
- initTable();
- }
- }
- });
- });
- }
- }
- };
- $('.demoTable #remove').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- });
- </script>
- </body>
- </html>
|