123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>客户报备</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport"
- content="width=customer-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
- <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
- <style type="text/css">
- .seach_items {
- float: right;
- margin-left: 10px;
- }
- </style>
- <style type="text/css">
- .LAY-btns .layui-nav {
- padding-left: 0;
- padding-right: 10px;
- top: -4px;
- margin: 0 10px;
- border: 0;
- background-color: #009688;
- }
- .LAY-btns .layui-nav .layui-nav-item {
- line-height: 40px;
- }
- .LAY-btns .layui-nav .layui-nav-child {
- top: 34px;
- }
- .LAY-btns .layui-nav .layui-nav-bar {
- display: none;
- }
- .LAY-btns .layui-nav .layui-nav-child dd.layui-this a {
- color: #333;
- background-color: #fff;
- }
- .LAY-btns .layui-nav .layui-nav-child dd.layui-this a:hover {
- background-color: #f2f2f2;
- color: #000;
- }
- </style>
- </head>
- <body>
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-body" pad15>
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="LAY-btns" style="margin-bottom: 10px;">
- <div style="float: left">
- <button class="layui-btn" id="customer_add" data-permission="customer.add_report_customer"><i
- class="layui-icon layui-icon-add-circle"></i>添加
- </button>
- </div>
- <form class="layui-form" lay-filter="query-form-element1">
- <div class="seach_items">
- <button class="layui-btn" lay-submit lay-filter="query-form-element1"><i
- class="layui-icon layui-icon-search"></i>查询
- </button>
- </div>
- <div class="seach_items">
- <select name="source" id="id_source" style="width: 40px;">
- <option value="">请选择来源</option>
- </select>
- </div>
- <div class="seach_items">
- <input type="text" name="tel" autocomplete="off" class="layui-input"
- placeholder="电话"/>
- </div>
- <div class="seach_items">
- <input type="text" name="name" autocomplete="off" class="layui-input"
- placeholder="姓名"/>
- </div>
- </form>
- <div style="clear: both;"></div>
- </div>
- <table class="layui-hide" id="customer_datagrid" lay-filter="customer-operate"></table>
- <script type="text/html" id="customer-operate-bar">
- <div class="layui-btn-group">
- <a class="layui-btn layui-btn-xs" lay-event="customer_edit"
- data-permission="customer.add_report_customer"
- >修改</a>
- </div>
- <div class="layui-btn-group">
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="customer_del"
- data-permission="customer.delete_report_customer"
- >删除</a>
- </div>
- </script>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="../../layuiadmin/layui/layui.js?t=1"></script>
- <script>
- layui.config({
- base: '../../../layuiadmin/' //静态资源所在路径
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['index', 'table', 'form',], function () {
- var $ = layui.$;
- var table = layui.table
- , form = layui.form
- , admin = layui.admin;
- table.render({
- elem: '#customer_datagrid'
- , url: '/customer/report_customer/'
- , cols: [[
- {field: 'name', title: '姓名', width: 120}
- , {field: 'gender_text', title: "性别", width: 70}
- , {field: 'tel', title: '电话', width: 120}
- , {field: 'village', title: '小区', width: 150}
- , {field: 'address', title: '地址', width: 200}
- , {field: 'source_text', title: '来源', width: 100}
- , {field: 'project_text', title: '项目', width: 200}
- , {field: 'notes', title: '备注', width: 200}
- , {field: 'report_status_text', title: '报备状态', width: 100}
- , {field: 'create_user_text', title: '报备人', width: 150}
- , {field: 'create_time_f', title: '报备时间', width: 150}
- , {field: 'check_user_text', title: '审核人', width: 100}
- , {field: 'check_time_f', title: '审核时间', width: 160}
- , {width: 130, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
- ]]
- , page: true
- , height: 'full-108'
- });
- admin.req({
- url: '/customer/dict/',
- done: function (res) {
- var data = res.data.source;
- var source_node = $('#id_source');
- for (var i in data) {
- var pid = data[i].id;
- var name = data[i].name;
- source_node.append("<option value='" + pid + "'>" + name + "</option>");
- }
- form.render('select');
- }
- });
- //监听工具条
- table.on('tool(customer-operate)', function (obj) {
- var data = obj.data;
- if (obj.event === 'customer_del') {
- if(data.report_status !== 0){
- layer.msg("只有待审核才允许删除");
- return
- }
- layer.confirm('确定要删除吗?', function (index) {
- layer.close(index);
- admin.req({
- url: '/customer/report_customer/' + data.id + '/'
- , type: 'delete'
- , done: function (res) {
- if(res.code === 0){
- layer.msg('删除成功!', {icon: 1})
- }
- table.reload('customer_datagrid', {});
- }
- });
- });
- } else if (obj.event === 'customer_edit') {
- if(data.report_status !== 0){
- layer.msg("只有待审核才允许修改");
- return
- }
- table.editdata = data;
- layer.open({
- type: 2,
- title: '修改',
- shadeClose: false,
- area: ['45%', '80%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- if(res.code === 0){
- layer.msg('修改成功!', {icon: 1})
- }
- layer.close(index);
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'edit.html?id=' + data.id
- });
- }
- });
- form.on('submit(query-form-element1)', function (data) {
- table.reload('customer_datagrid', {
- where: data.field
- , page: {curr: 1}
- });
- layer.closeAll();
- return false
- });
- $('#customer_add').on('click', function () {
- layer.open({
- type: 2,
- title: '添加',
- area: ['45%', '80%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- parent.layui.getTipsData();
- layer.close(index);
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'edit.html'
- });
- });
- });
- </script>
- </body>
- </html>
|