| | |
| | | var pageCurr; |
| | | var pageCount = 0; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin'], function(){ |
| | | }).extend({ |
| | | dropdown: 'dropdown/dropdown', |
| | | }).use(['table','laydate', 'form', 'admin', 'xmSelect', 'dropdown', 'element'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var xmSelect = layui.xmSelect; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | cellMinWidth: 100, |
| | | height: 'full-120', |
| | | size: 'sm', |
| | | skin: 'nob', |
| | | height: 'full-145', |
| | | // size: 'sm', |
| | | skin: 'line', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | // ,{field: 'hostId$', align: 'center',title: '所属商户'} |
| | | ,{field: 'deptId$', align: 'center',title: '所属部门', hide: true} |
| | | ,{field: 'userId$', align: 'center',title: '所属人员'} |
| | | ,{field: 'cstmrType$', align: 'center',title: '客户类别'} |
| | | ,{field: 'uuid', align: 'center',title: '客户代号'} |
| | | ,{field: 'name', align: 'center',title: '客户名称'} |
| | | ,{field: 'simple', align: 'center',title: '客户简称', hide: true} |
| | | ,{field: 'rela', align: 'center',title: '客户关系'} |
| | | ,{field: 'tel', align: 'center',title: '电话'} |
| | | ,{field: 'contacts', align: 'center',title: '客户联系人'} |
| | | ,{field: 'remarks', align: 'center',title: '备注', hide: true} |
| | | ,{field: 'director$', align: 'center',title: '负责人'} |
| | | ,{field: 'province', align: 'center',title: '省', hide: true} |
| | | ,{field: 'city', align: 'center',title: '市', hide: true} |
| | | ,{field: 'district', align: 'center',title: '县', hide: true} |
| | | ,{field: 'town', align: 'center',title: '镇', hide: true} |
| | | ,{field: 'addr', align: 'center',title: '详细地址'} |
| | | ,{field: 'type$', align: 'center',title: '区分'} |
| | | ,{field: 'files', align: 'center',title: '附件', hide: true} |
| | | ,{field: 'status$', align: 'center',title: '状态', hide: true} |
| | | ,{field: 'createBy$', align: 'center',title: '添加人员', hide: true} |
| | | ,{field: 'createTime$', align: 'center',title: '添加时间', hide: true} |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员'} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'memo', align: 'center',title: '注释', hide: true} |
| | | ,{field: 'name', align: 'left',title: '客户名称'} |
| | | ,{field: 'uuid', align: 'left',title: '客户代号'} |
| | | ,{field: 'addr', align: 'left',title: '详细地址', templet:function(d){return emptyShow(d.addr)}} |
| | | ,{field: 'tel', align: 'left',title: '电话', templet:function(d){return emptyShow(d.tel)}} |
| | | ,{field: 'remarks', align: 'left',title: '备注', templet:function(d){return emptyShow(d.remarks)}} |
| | | ,{field: 'createTime$', align: 'left',title: '添加时间'} |
| | | ,{field: 'userId$', align: 'left',title: '添加人员'} |
| | | ,{field: 'cstmrType$', align: 'left',title: '客户类别'} |
| | | ,{field: 'deptId$', align: 'left',title: '所属部门', hide: true} |
| | | ,{field: 'simple', align: 'left',title: '客户简称', hide: true} |
| | | ,{field: 'rela', align: 'left',title: '客户关系', hide: true} |
| | | ,{field: 'contacts', align: 'left',title: '客户联系人', hide: true} |
| | | ,{field: 'director$', align: 'left',title: '负责人', hide: true} |
| | | ,{field: 'province', align: 'left',title: '省', hide: true} |
| | | ,{field: 'city', align: 'left',title: '市', hide: true} |
| | | ,{field: 'district', align: 'left',title: '县', hide: true} |
| | | ,{field: 'town', align: 'left',title: '镇', hide: true} |
| | | ,{field: 'type$', align: 'left',title: '区分', hide: true} |
| | | ,{field: 'files', align: 'left',title: '附件', hide: true} |
| | | ,{field: 'status$', align: 'left',title: '状态', hide: true} |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员', hide: true} |
| | | ,{field: 'updateBy$', align: 'left',title: '修改人员', hide: true} |
| | | ,{field: 'updateTime$', align: 'left',title: '修改时间', hide: true} |
| | | ,{field: 'memo', align: 'left',title: '注释', hide: true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | ]], |
| | |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | pageCount = count; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 添加 |
| | | $("#cstmrAddBtn").click(function () { |
| | | showEditModel(); |
| | | }); |
| | | |
| | | // 删除 |
| | | form.on('submit(cstmrDel)', function (data) { |
| | | let checkStatus = layui.table.checkStatus('cstmr').data; |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | }); |
| | | |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(cstmr)', function (obj) { |
| | |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(cstmr)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | | switch(obj.event) { |
| | | case 'addData': |
| | | showEditModel(); |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(cstmr)', function(obj){ |
| | |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | area: '1500px', |
| | | title: (mData ? '修改' : '添加') + '甲方单位', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(mData); |
| | |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | tableReload() |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | tableReload(); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | function tableReload() { |
| | | if (pageCount === 0) { |
| | | let searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | } |