123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
- var form = layui.form,
- layer = layui.layer,
- $ = layui.jquery,
- laydate = layui.laydate,
- table = layui.table,
- layedit = layui.layedit
- ,upload = layui.upload;
- var tableIds = 'wxuserlist';
-
- var tableIns = table.render({
- elem: '#'+tableIds,
- url : '/wx/yhomeform',
- method:'post',
- page : true,
- limit : 20,
- id:'tablerReload',
- cols : [[
- {type: "checkbox", width:50},
- {type:'numbers'},
- {field: 'text', title: '语录', align:"center",sort: true},
-
- {title: '操作', width:150, templet:'#housesListBar',fixed:"right",align:"center"}
- ]]
- });
-
-
- var $ = layui.$, active = {
- addData: function(){
- var index = layui.layer.open({
- title : "添加语录",
- type : 2,
- area:['80%','100%'],
- maxmin: true,
- content : "/wx/ycreate",
- end:function () {
- table.reload('tablerReload');
- }
- })
- },
- reload:function () {
- var form = pfgs_serialize($('form'));
- table.reload('tablerReload',{
- where:{
- name:form.name,
- }
- })
- }
- };
- $('.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('/wx/ydel',{id:data.id},function (data) {
- layer.msg(data.msg);
- table.reload('tablerReload');
-
-
-
-
-
-
-
- })
- })
- } else if(obj.event === 'edit'){
- var index = layui.layer.open({
- title : "编辑语录",
- type : 2,
- area:['80%','100%'],
- maxmin: true,
- content : "/wx/yedit?id="+data.id,
- end:function () {
- table.reload('tablerReload');
- }
- })
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- });
-
- form.on('submit(addyl)',function (data) {
- var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
- $.post('/wx/ycreateform',{data:data.field},function (data) {
- layer.msg(data.msg);
-
-
-
-
-
-
-
- table.reload('tablerReload');
- })
- return false;
- })
-
- form.on('submit(edityl)',function (data) {
- var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
- $.post('/wx/yeditform',{data:data.field},function (data) {
- layer.msg(data.msg);
-
-
-
-
-
-
-
- table.reload('tablerReload');
- })
- return false;
- })
- });
|