123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
- var form = layui.form,
- // layer = parent.layer === undefined ? layui.layer : top.layer,
- layer = layui.layer,
- $ = layui.jquery,
- table = layui.table,
- layedit = layui.layedit
- //表格头部操作菜单
- var $ = layui.$, active = {
- mobile: function(){ //获取选中数据
- alert(0)
- },
- pc:function () {
- alert(1)
- },
- backend:function () {
- alert(2)
- }
- };
- function cacheClear(type) {
- layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
- $.post('/news/newsdel',{id:data.id},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- }
- })
- })
- }
- //监听指定开关
- form.on('switch(switchTest)', function(data){
- layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
- $.post('/house/housesortedit',{id:data.value,examineid:1},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- }
- })
- },function (aa) {
- table.reload('tablerReload'); //重新加载
- })
- });
- $('.demoTable .layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- //表格右边操作栏目
- table.on('tool('+tableIds+')', function(obj){
- var data = obj.data;
- if(obj.event === 'del'){ //删除操作
- layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
- $.post('/news/newsdel',{id:data.id},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- }
- })
- })
- } else if(obj.event === 'edit'){ //编辑操作
- var index = layui.layer.open({
- title : "编辑资讯",
- type : 2,
- area:['','100%'],
- maxmin: true,
- content : "/news/newsedit?id="+data.id
- })
- layui.layer.full(index);
- //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
- $(window).on("resize",function(){
- layui.layer.full(index);
- })
- }
- });
- });
|