123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- layui.use([ 'laypage', 'layer', 'table', 'element','form','upload'], function(){
- var laypage = layui.laypage
- ,layer = layui.layer
- ,table = layui.table
- ,element = layui.element
- ,form = layui.form
- ,upload = layui.upload;
- var tableIds = 'developerlist';
-
- var indexTtable = table.render({
- elem: '#'+tableIds
- ,url: '/dictionaryb/developerform'
- ,where:{token:csrfToken}
- ,method:'post'
- ,page: true
- ,text:'数据加载中'
- ,id:'tablerReload'
- ,cols: [[
-
- {type:'numbers'},
- {field: 'name', title: '开发商名称', align:'center'}
- ,{field: 'logo', title: 'LOGO', width:150,align:'center',templet:function(d){
- return '<img class="layui_magnify" src="'+d.logo+'">';
- }}
- ,{field: 'info', title: '简介', width:300,align:'center'}
- ,{field: 'allow', title: '是否推荐', width:150,align:'center'}
- ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
- ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
- ]]
- });
- indexTtable.reload('tablerReload');
-
- table.on('tool('+tableIds+')', function(obj){
- var layEvent = obj.event,
- data = obj.data;
- if(layEvent === 'edit'){
- layer.open({
- type: 2,
- title: '修改标签',
- closeBtn: 1,
- shade: [0],
- area: ['900px','550px'],
- anim: 2,
- content: ['/dictionaryb/developeredit?id='+data.id, 'yes'],
- });
- } else if(layEvent === 'del') {
- layer.confirm('您确定要删除吗?',{ btn: ['确定', '取消']},function () {
- $.post('/dictionaryb/developerdel',{'id':data.id},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- table.reload(tableIds);
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- }
- })
- })
- }
- });
- var $ = layui.$, active = {
- addData: function(){
- layer.open({
- type: 2,
- title: '添加开发商',
- closeBtn: 1,
- shade: [0],
- area: ['900px','550px'],
- anim: 2,
- content: ['/dictionaryb/developeradd', 'yes'],
- });
-
-
-
- },
- reload:function(){
- var form = pfgs_serialize($('form'));
-
-
-
-
-
-
-
- var city = '';
- table.reload('tablerReload',{
- where:{
- name: form.input_name_text,
- tel:form.input_tel_text,
- city:city,
- },
- page:{
- curr:1
- }
- });
- },
- };
- $('.demoTable .layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
-
- form.on('submit(editdeveloper)', function(data){
-
- var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
- var formData = new FormData($('form')[0]);
- $.ajax({
- cache : true,
- type : "post",
- url : '/dictionaryb/developereditform',
- data : formData,
-
- contentType: false,
- processData: false,
- error : function(request) {
- layer.close(index);
- layer.alert("网络超时");
- },
- success : function(data) {
- if (data.code == 200) {
- layer.msg(data.msg);
- } else if(data.code == 300){
- layer.msg(data.msg);
- layer.msg(ReturnInfo(data.data));
- }
- }
- });
- return false;
- });
-
- form.on('submit(adddeveloper)', function(data){
- var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
- var formData = new FormData($('form')[0]);
- $.ajax({
- cache : true,
- type : "post",
- url : '/dictionaryb/developeraddform',
- data : formData,
-
- contentType: false,
- processData: false,
- error : function(request) {
- layer.close(index);
- layer.alert("网络超时");
- },
- success : function(data) {
- if (data.code == 200) {
- layer.msg(data.msg);
- } else if(data.code == 300){
- layer.msg(data.msg);
- layer.msg(ReturnInfo(data.data));
- }
- }
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
- return false;
- });
-
- $('.layui-table').on('click','.layui_magnify', function(){
- var _src = $(this).attr('src');
- layui.layer.open({
- type: 1,
- title: false,
- area: ['60%', '80%'],
- shade: 0.6,
- closeBtn: 1,
- shadeClose: true,
- content: '<img style="width:100%;height:100%" src="'+_src+'">',
- });
- });
-
- $('.layui_magnify').on('click', function(){
- var _src = $(this).attr('src');
- layui.layer.open({
- type: 1,
- title: false,
- area: ['60%', '80%'],
- shade: 0.6,
- closeBtn: 1,
- shadeClose: true,
- content: '<img style="width:100%;height:100%" src="'+_src+'">',
- });
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- upload.render({
- elem: '#test1'
- ,url: '/house/createimg'
- ,data:{token:csrfToken}
- ,field:'img'
- ,size:1000
- ,exts: 'png|jpg|jpeg'
- ,auto:false
- ,bindAction:'#addcity'
- ,choose: function(obj){
- obj.preview(function(index, file, result){
- $('#breviary_img').attr('src', result);
- });
- }
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function unlinkImage(name){
- if(name != 'undefined'){
- $.post('/dictionaryb/developerunimg',{imgname:name},function (data) {
- })
- }
- }
-
-
-
-
-
-
-
-
-
-
- });
|