123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- 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,
- laydate = layui.laydate,
- laytpl = layui.laytpl,
- table = layui.table,
- layedit = layui.layedit
- ,upload = layui.upload;
- var house_id = $('input[name="house_id"]').val();
- //调用编辑器
- var tableIds = 'presellList';
- var reloadId = 'tablerReload';
- //楼盘列表
- var tableIns = table.render({
- elem: '#'+tableIds,
- url : '/house/presellform',
- cellMinWidth : 90,
- method:'post',
- where:{hid:house_id},
- page : true,
- height : "full-125",
- limit : 20,
- id:reloadId,
- cols : [[
- // {type: "checkbox", width:50},
- {type:'numbers',title:'序号',width:100},
- // {field: 'id', title: 'ID', width:100, align:"center",sort: true},
- {field: 'permit', title: '预售许可证',width:250,sort:true, align:'center'},
- {field: 'time', title: '发证时间',width:200,sort:true, align:'center'},
- {field: 'building_num', title: '绑定楼栋',sort:true, align:'center'},
-
- {title: '操作', width:150, templet:'#housesListBar',fixed:"right",align:"center"}
- ]]
- });
- tableIns.reload('tablerReload'); //重新加载
- var $ = layui.$, active = {
- addData: function(){ //获取选中数据
- var index = parent.layui.layer.open({
- title : "添加预售证",
- type : 2,
- area: ['600px', '500px'],
- content : "/house/preselladd?hid="+house_id,
- end:function(){
- layui.table.reload('tablerReload');
- }
- })
- // parent.layui.layer.full(index);
- // // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
- // $(window).on("resize",function(){
- // parent.layui.layer.full(index);
- // })
- }
- };
- $('.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 === 'presellEdit'){ //修改排序
- var index =layui.layer.open({
- type: 2,
- title: '修改用户信息',
- area: ['600px', '500px'],
- anim: 2,
- content: '/house/preselledit?id='+data.id //iframe的url,no代表不显示滚动条
- ,end:function(){
- layui.table.reload('tablerReload');
- }
- })
- } else if(obj.event === 'presellDel'){
- layer.confirm('您确认要删除吗?',{btn:['确认','取消']},function () {
- $.post('/house/preselldel',{id:data.id},function (data) {
- if (data.code == 200) {
- layer.msg(data.msg);
- // parent.layui.
- table.reload('tablerReload');
- // TableClose();
- } else {
- layer.msg(data.msg);
- }
- })
- })
- // $.post('/house/preselldel',{id:data.id},function (data) {
- // if (data.code == 200) {
- // layer.msg(data.msg);
- // // parent.layui.
- // table.reload('tablerReload');
- // // TableClose();
- // } else {
- // layer.msg(data.msg);
- // }
- // })
- }
- })
- //修改页面显示插件
- laydate.render({
- elem: '#test1'
- });
-
- // // 批量删除
- // form.on('submit(del_alls_house)',function (data) {
- // var checkStatus = table.checkStatus('tablerReload');
- // var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
- // if(typeof checkStatus.data[0] == 'object'){
- // layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
- // var formdat = new FormData();
- // $.each(checkStatus.data,function (key,val) {
- // formdat.append('hid[]',val.id);
- // })
- // $.ajax({
- // cache : true,
- // type : "post",
- // url : "/house/housede",
- // data : formdat, // 你的formid
- // // async : false, //async 默认为true异步,修改为false为同步
- // contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
- // processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
- // error : function(request) {
- // layer.close(index); //关闭数据提交信息
- // layer.alert("网络超时");
- // },
- // success : function(data) {
- // if (data.code == 200) {
- // layer.msg(data.msg);
- // reloadTable(reloadId);
- // } else {
- // layer.msg(data.msg);
- // }
- // }
- // });
- //
- // })
- // return false;
- //
- // }
- // layer.msg('请选择需要删除的楼盘',{icon:5});
- // return false;
- // }) // 批量删除 END
- // 添加预售证
- $('.layui_w_addbtn').on('click',function(){
- datumInsert()
- // alert(516)
- })
- //展示数据删除按钮
- $('table.layui-table tbody').on('click','.del',function(){
- var _this = $(this)
- var oid = _this.attr('lay-oid');
- var index =layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
- // layer.close(index)
- if(oid != ''){
- $.post('/house/peitaodel',{data:oid},function (data) {
- if(data.code == 200){
- _this.parents('tr').remove();
- layer.msg(data.msg);
- table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- }
- })
- }else {
- _this.parents('tr').remove();
- layer.msg('已成功删除!');
- }
-
- })
- })
- // 数据提交
- form.on('submit(preselladd)',function (data) {
- var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
-
- var formData = new FormData($('#preselladd')[0]);
- $.ajax({
- cache : true,
- type : "post",
- url : "/house/preselladdform",
- data : formData, // 你的formid
- contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
- processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
- error : function(request) {
- layer.close(index); //关闭数据提交信息
- layer.alert("网络超时");
- },
- success : function(data) {
- if(data.data != null){
- layer.msg(ReturnInfo(data.data),{icon:5});
- return ;
- }
- $('input[name="permit"]').val('');
- $('input[name="time"]').val('');
- $('input[name="building_num"]').val('');
- layer.msg(data.msg);
- }
- });
- return false;
- })
- // 修改页面数据提交
- form.on('submit(presellEditSubmit)',function (data) {
- var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
- var formData = new FormData($('#preselledit')[0]);
- $.ajax({
- cache : true,
- type : "post",
- url : "/house/preselleditform",
- data : formData, // 你的formid
- // async : false, //async 默认为true异步,修改为false为同步
- contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
- processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
- error : function(request) {
- layer.close(index); //关闭数据提交信息
- layer.alert("请联系管理员");
- },
- success : function(data) {
- if(data.data != null){
- layer.msg(ReturnInfo(data.data),{icon:5});
- return ;
- }
- layer.msg(data.msg);
- }
- });
- return false;
- });
-
- })
- // $(function(){
- // // 动态添加批量删除按钮
- // var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
- // + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">批量删除</a>'
- // + '</div>'
- // $('.layui-form').append(_btn)
- //
- // })
- //预售许可证 添加
- function datumInsert(){
- var tr ='<tr>'
- +'<td lay-event="del">'
- +'<div class="layui-table-cell del" lay-oid=""><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer"></i></div>'
- +'</td>'
- +'<td data-field="matingName" align="center" data-content="">'
- +'<div class="layui-table-cell"><input type="text" name="licenseKey" value="" autocomplete="off" class="layui-input" ></div>'
- +'</td>'
- +'<td data-field="distance" align="center" data-content="">'
- +'<div class="layui-table-cell"><input type="text" name="issueDate" value="" autocomplete="off" class="layui-input" ></div>'
- +'</td>'
- +'<td data-field="longitude" align="center" data-content="">'
- +'<div class="layui-table-cell"><input type="text" id="jwd" name="buildingName" value="" autocomplete="off" class="layui-input" ></div>'
- +'</td>'
- +'</tr>';
- $(".layui_w_licence table.layui-table tbody").append(tr);
- }
|