xxxrrrdddd 2 年之前
父节点
当前提交
c77ef26814
共有 3 个文件被更改,包括 361 次插入344 次删除
  1. 11 2
      application/admin/controller/Mobile.php
  2. 338 342
      public/assets/js/backend/mobile.js
  3. 12 0
      public/assets/js/require-table.js

+ 11 - 2
application/admin/controller/Mobile.php

@@ -76,8 +76,13 @@ class Mobile extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildindexparams();
 
+            $relation=['info'];
+            if(!$this->admin('sub')){
+                $relation[]='proxy';
+            }
+
             $list = $this->model
-                    ->with(['info','proxy'])
+                    ->with($relation)
                     ->where($where)
                 ->where('mobile.type',1)
                     ->orderRaw($this->getOrder())
@@ -148,9 +153,13 @@ class Mobile extends Backend
             if($this->admin('sub')){
                 $map['hold_chan']=$this->auth->id;
             }
+            $relation=['info'];
+            if(!$this->admin('sub')){
+                $relation[]='proxy';
+            }
 
             $list = $this->model
-                ->with(['info','proxy'])
+                ->with($relation)
                 ->where($where)
                 ->where($map)
                 ->where('mobile.type',1)

+ 338 - 342
public/assets/js/backend/mobile.js

@@ -101,194 +101,186 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 Fast.api.open(`${$(this).data('url')}`,$(this).text())
             })
 
-            // 初始化表格
-            table.bootstrapTable({
-                url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'id',
-                search: false,
-                searchFormVisible: true,
-                fixedColumns: true,
-                fixedRightNumber:1,
-                columns: [
-                    [
-                        {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'no', title: __('手机号'), operate: "LIKE"},
-                        {field: 'province', title: __('Province'),operate: 'LIKE'},
-                        {field: 'city', title: __('归属地'),operate: 'LIKE'},
-                        {field: 'network', title: __('运营商'), formatter: Table.api.formatter.label,searchList: mobile_network},
-                        {field: 'proxy.nickname', title: __('供应商'), formatter: Table.api.formatter.label,operate: 'LIKE'},
-                        {field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label, operate: "LIKE"},
-                        {
-                            field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
-                                return a.join('<br>')
-                            }
-                        },
-                        {
-                            field: 'info.describe',
-                            title: __('套餐信息'),
-                            operate: "like",
-                            formatter: Table.api.formatter.content,
-                            width: 200
-                        },
-                        {field: 'amount_original', title: __('Amount_original'), operate: false},
-                        {field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
-                        {field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
-                        {field: 'amount_kill', title: __('秒杀价'), operate: 'BETWEEN'},
-                        {field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
-                        {field: 'remark', title: __('备注'), operate: 'like'},
-                        {
-                            field: 'top_time',
-                            title: __('Top_time'),
-                            //operate: 'RANGE',
-                            //addclass: 'datetimerange',
-                            autocomplete: false,
-                           /* formatter(a, b, c) {
-                                return `<a data-toggle="switcher" class="btn-switcher btn-change-top" data-id="${b.id}" data-value="${a ? a : ''}">
-                                    <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
-                                    </a>`
-                            }*/
-                            formatter: Table.api.formatter.toggle,
-                            searchList: {1:'是',0:'否'},
-                        },
-                        {
-                            field: 'rec_time',
-                            title: __('Rec_time'),
-                            //operate: 'RANGE',
-                            //addclass: 'datetimerange',
-                            autocomplete: false,
-                            /*formatter(a, b, c) {
-                                return `<a data-toggle="switcher" class="btn-switcher btn-change-rec" data-id="${b.id}" data-value="${a ? a : ''}">
-                                    <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
-                                    </a>`
-                            }*/
-                            formatter: Table.api.formatter.toggle,
-                            searchList: {1:'是',0:'否'},
-                        },
-                        //{field: 'is_hold', title: __('预占'),formatter: Table.api.formatter.toggle,searchList:{0:'否',1:'是'}},
-                        {
-                            field: 'buttons',
-                            width: "120px",
-                            title: __('操作'),
-                            table: table,
-                            events: Table.api.events.operate,
-                            operate: false,
-                            formatter: Table.api.formatter.buttons,
-                            buttons: [
-                                {
-                                    name: 'detail',
-                                    text: __('预占'),
-                                    title: __('预占'),
-                                    classname: 'btn btn-xs btn-info btn-dialog',
-                                    url: 'mobile/takeit',
-                                    callback: function (data) {
-                                    },
-                                    visible: function (row) {
-                                        return table.data('operate-mobile_takeit') && row.is_activity===0;
-                                    }
+            let columns= [
+                    {checkbox: true},
+                    {field: 'id', title: __('Id')},
+                    {field: 'no', title: __('手机号'), operate: "LIKE"},
+                    {field: 'province', title: __('Province'),operate: 'LIKE'},
+                    {field: 'city', title: __('归属地'),operate: 'LIKE'},
+                    {field: 'network', title: __('运营商'), formatter: Table.api.formatter.label,searchList: mobile_network},
+                    {field: 'proxy.nickname', title: __('供应商'), formatter: Table.api.formatter.label,operate: 'LIKE'},
+                    {field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label, operate: "LIKE"},
+                    {
+                        field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
+                            return a.join('<br>')
+                        }
+                    },
+                    {
+                        field: 'info.describe',
+                        title: __('套餐信息'),
+                        operate: "like",
+                        formatter: Table.api.formatter.content,
+                        width: 200
+                    },
+                    {field: 'amount_original', title: __('Amount_original'), operate: false},
+                    {field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
+                    {field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
+                    {field: 'amount_kill', title: __('秒杀价'), operate: 'BETWEEN'},
+                    {field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
+                    {field: 'remark', title: __('备注'), operate: 'like'},
+                    {
+                        field: 'top_time',
+                        title: __('Top_time'),
+                        //operate: 'RANGE',
+                        //addclass: 'datetimerange',
+                        autocomplete: false,
+                        /* formatter(a, b, c) {
+                             return `<a data-toggle="switcher" class="btn-switcher btn-change-top" data-id="${b.id}" data-value="${a ? a : ''}">
+                                 <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
+                                 </a>`
+                         }*/
+                        formatter: Table.api.formatter.toggle,
+                        searchList: {1:'是',0:'否'},
+                    },
+                    {
+                        field: 'rec_time',
+                        title: __('Rec_time'),
+                        //operate: 'RANGE',
+                        //addclass: 'datetimerange',
+                        autocomplete: false,
+                        /*formatter(a, b, c) {
+                            return `<a data-toggle="switcher" class="btn-switcher btn-change-rec" data-id="${b.id}" data-value="${a ? a : ''}">
+                                <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
+                                </a>`
+                        }*/
+                        formatter: Table.api.formatter.toggle,
+                        searchList: {1:'是',0:'否'},
+                    },
+                    {
+                        field: 'buttons',
+                        width: "120px",
+                        title: __('操作'),
+                        table: table,
+                        events: Table.api.events.operate,
+                        operate: false,
+                        formatter: Table.api.formatter.buttons,
+                        buttons: [
+                            {
+                                name: 'detail',
+                                text: __('预占'),
+                                title: __('预占'),
+                                classname: 'btn btn-xs btn-info btn-dialog',
+                                url: 'mobile/takeit',
+                                callback: function (data) {
                                 },
-                                {
-                                    name: 'detail',
-                                    text: __('取消预占'),
-                                    title: __('取消预占'),
-                                    classname: 'btn btn-xs btn-warning btn-ajax',
-                                    confirm: '确认取消吗?',
-                                    url: 'mobile/activity_cancel?aaa=1',
-                                    success: function (data) {
-                                        $('.btn-refresh').trigger('click')
-                                    },
-                                    visible: function (row) {
-                                        return table.data('operate-activity_cancel') && row.is_activity===1;
-                                    },
-                                    disable(row){
-                                        return admin_Info.sub && row.hold_chan!==admin_Info.id
-                                    }
+                                visible: function (row) {
+                                    return table.data('operate-mobile_takeit') && row.is_activity===0;
+                                }
+                            },
+                            {
+                                name: 'detail',
+                                text: __('取消预占'),
+                                title: __('取消预占'),
+                                classname: 'btn btn-xs btn-warning btn-ajax',
+                                confirm: '确认取消吗?',
+                                url: 'mobile/activity_cancel?aaa=1',
+                                success: function (data) {
+                                    $('.btn-refresh').trigger('click')
                                 },
-                                {
-                                    name: 'detail',
-                                    text: __('记录'),
-                                    title: __('记录'),
-                                    classname: 'btn btn-xs btn-info btn-dialog',
-                                    url: 'mobile_price_log/index?a=1',
-                                    callback: function (data) {
-                                    },
-                                    visible: function (row) {
-                                        return true;
-                                    }
+                                visible: function (row) {
+                                    return table.data('operate-activity_cancel') && row.is_activity===1;
                                 },
-                            ]
-                        },
-                        {field: 'status', title: __('号码状态'), formatter (a,b){
+                                disable(row){
+                                    return admin_Info.sub && row.hold_chan!==admin_Info.id
+                                }
+                            },
+                            {
+                                name: 'detail',
+                                text: __('记录'),
+                                title: __('记录'),
+                                classname: 'btn btn-xs btn-info btn-dialog',
+                                url: 'mobile_price_log/index?a=1',
+                                callback: function (data) {
+                                },
+                                visible: function (row) {
+                                    return true;
+                                }
+                            },
+                        ]
+                    },
+                    {field: 'status', title: __('号码状态'), formatter (a,b){
                             if(b.is_activity){
                                 return `<span style="color: red"><div>●</div>预占</span>`
                             }else{
                                 return mobileStatus[a]
                             }
-                            }, searchList: mobileStatus},
-                        {
-                            field: 'update_time',
-                            title: __('Update_time'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            autocomplete: false,
-                            formatter: Table.api.formatter.datetime
-                        },
-                        {
-                            field: 'create_time',
-                            title: __('上架时间'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            autocomplete: false,
-                            formatter: Table.api.formatter.datetime
-                        },
-                        {field: 'sort', title: __('Sort'), operate: "BETWEEN"},
-                        {field: 'hold_chan', title: __('预占通道'), operate: "="},
-                        {field: 'hold_user', title: __('预占用户ID'), operate: "="},
-                        {field: 'admin_id', title: __('上传用户'), operate: "="},
-
-                        /*{field: 'name', title: __('Name')},
-                        {field: 'type', title: __('Type'),formatter: Table.api.formatter.label,searchList:no_type},
-                        {field: 'amount_exists', title: __('Amount_exists'), operate:'BETWEEN'},
-                        {field: 'amount_base', title: __('Amount_base'), operate:'BETWEEN'},
-                        {field: 'summary', title: __('Summary')},
-                        {field: 'saled', title: __('Saled'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
-                        {field: 'is_activity', title: __('Is_activity'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
-                        {field: 'activity_time_end', title: __('Activity_time_end'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
-                        {field: 'sort', title: __('Sort'),operate: "BETWEEN"},*/
-                        {
-                            field: 'operate',
-                            title: __('Operate'),
-                            table: table,
-                            events: Table.api.events.operate,
-                            formatter: Table.api.formatter.operate,
-                            buttons: [
-                                {
-                                    name: 'detail',
-                                    text: __('记录'),
-                                    title: __('记录'),
-                                    classname: 'btn btn-xs btn-info btn-dialog',
-                                    url: 'mobile_price_log/index?a=1',
-                                    callback: function (data) {
-                                    },
-                                    visible: function (row) {
-                                        return table.data('operate-mobile_price_log');
-                                    }
+                        }, searchList: mobileStatus},
+                    {
+                        field: 'update_time',
+                        title: __('Update_time'),
+                        operate: 'RANGE',
+                        addclass: 'datetimerange',
+                        autocomplete: false,
+                        formatter: Table.api.formatter.datetime
+                    },
+                    {
+                        field: 'create_time',
+                        title: __('上架时间'),
+                        operate: 'RANGE',
+                        addclass: 'datetimerange',
+                        autocomplete: false,
+                        formatter: Table.api.formatter.datetime
+                    },
+                    {field: 'sort', title: __('Sort'), operate: "BETWEEN"},
+                    {field: 'hold_chan', title: __('预占通道'), operate: "="},
+                    {field: 'hold_user', title: __('预占用户ID'), operate: "="},
+                    {field: 'admin_id', title: __('上传用户'), operate: "="},
+                    {
+                        field: 'operate',
+                        title: __('Operate'),
+                        table: table,
+                        events: Table.api.events.operate,
+                        formatter: Table.api.formatter.operate,
+                        buttons: [
+                            {
+                                name: 'detail',
+                                text: __('记录'),
+                                title: __('记录'),
+                                classname: 'btn btn-xs btn-info btn-dialog',
+                                url: 'mobile_price_log/index?a=1',
+                                callback: function (data) {
                                 },
-                                {
-                                    name: 'detail',
-                                    text: '排序',
-                                    title: '排序',
-                                    classname: 'btn btn-dialog btn-info btn-xs',
-                                    url: 'mobile/mobile_sort',
-                                    visible(row){
-                                        return table.data('operate-mobile_sort')
-                                    }
+                                visible: function (row) {
+                                    return table.data('operate-mobile_price_log');
                                 }
-                            ]
-                        },
-                    ]
-                ],
+                            },
+                            {
+                                name: 'detail',
+                                text: '排序',
+                                title: '排序',
+                                classname: 'btn btn-dialog btn-info btn-xs',
+                                url: 'mobile/mobile_sort',
+                                visible(row){
+                                    return table.data('operate-mobile_sort')
+                                }
+                            }
+                        ]
+                    },
+                ]
+            if(admin_Info.sub){
+                Table.api.removeColumn('proxy.nickname',columns)
+            }
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                search: false,
+                searchFormVisible: true,
+                fixedColumns: true,
+                fixedRightNumber:1,
+                columns: [columns],
                 onLoadSuccess(){
 
                 }
@@ -369,181 +361,185 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             mobile_status.forEach((item,idx)=>{
                 mobileStatus[idx]=item
             })
-            // 初始化表格
-            table.bootstrapTable({
-                url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'id',
-                search: false,
-                searchFormVisible: true,
-                columns: [
-                    [
-                        {checkbox: true},
-                        //{field: 'id', title: __('Id')},
-                        {field: 'no', title: __('手机号'), operate: "LIKE"},
-                        {field: 'province', title: __('Province'),operate: 'LIKE'},
-                        {field: 'city', title: __('归属地'),operate: 'LIKE'},
-                        {field: 'network', title: __('运营商'), formatter: Table.api.formatter.label,searchList: mobile_network},
-                        {field: 'proxy.nickname', title: __('供应商'), formatter: Table.api.formatter.label,operate: 'LIKE'},
-                        {field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label, operate: "LIKE"},
+            let columns=[
+                {checkbox: true},
+                //{field: 'id', title: __('Id')},
+                {field: 'no', title: __('手机号'), operate: "LIKE"},
+                {field: 'province', title: __('Province'),operate: 'LIKE'},
+                {field: 'city', title: __('归属地'),operate: 'LIKE'},
+                {field: 'network', title: __('运营商'), formatter: Table.api.formatter.label,searchList: mobile_network},
+                {field: 'proxy.nickname', title: __('供应商'), formatter: Table.api.formatter.label,operate: 'LIKE'},
+                {field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label, operate: "LIKE"},
+                {
+                    field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
+                        return a.join('<br>')
+                    }
+                },
+                {
+                    field: 'info.describe',
+                    title: __('套餐信息'),
+                    operate: "like",
+                    formatter: Table.api.formatter.content,
+                    width: 200
+                },
+                {field: 'amount_original', title: __('Amount_original'), operate: false},
+                {field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
+                {field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
+                {field: 'amount_kill', title: __('秒杀价'), operate: 'BETWEEN'},
+                {field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
+                {field: 'remark', title: __('备注'), operate: 'like'},
+                {
+                    field: 'top_time',
+                    title: __('Top_time'),
+                    //operate: 'RANGE',
+                    //addclass: 'datetimerange',
+                    autocomplete: false,
+                    /* formatter(a, b, c) {
+                         return `<a data-toggle="switcher" class="btn-switcher btn-change-top" data-id="${b.id}" data-value="${a ? a : ''}">
+                             <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
+                             </a>`
+                     }*/
+                    formatter: Table.api.formatter.toggle,
+                    searchList: {1:'是',0:'否'},
+                },
+                {
+                    field: 'rec_time',
+                    title: __('Rec_time'),
+                    //operate: 'RANGE',
+                    //addclass: 'datetimerange',
+                    autocomplete: false,
+                    /*formatter(a, b, c) {
+                        return `<a data-toggle="switcher" class="btn-switcher btn-change-rec" data-id="${b.id}" data-value="${a ? a : ''}">
+                            <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
+                            </a>`
+                    }*/
+                    formatter: Table.api.formatter.toggle,
+                    searchList: {1:'是',0:'否'},
+                },
+                //{field: 'is_hold', title: __('预占'),formatter: Table.api.formatter.toggle,searchList:{0:'否',1:'是'}},
+                {
+                    field: 'buttons',
+                    width: "120px",
+                    title: __('操作'),
+                    table: table,
+                    events: Table.api.events.operate,
+                    operate: false,
+                    formatter: Table.api.formatter.buttons,
+                    buttons: [
                         {
-                            field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
-                                return a.join('<br>')
+                            name: 'detail',
+                            text: __('预占'),
+                            title: __('预占'),
+                            classname: 'btn btn-xs btn-info btn-dialog',
+                            url: 'mobile/takeit',
+                            callback: function (data) {
+                            },
+                            visible: function (row) {
+                                return table.data('operate-mobile_takeit') && row.is_activity===0;
                             }
                         },
                         {
-                            field: 'info.describe',
-                            title: __('套餐信息'),
-                            operate: "like",
-                            formatter: Table.api.formatter.content,
-                            width: 200
-                        },
-                        {field: 'amount_original', title: __('Amount_original'), operate: false},
-                        {field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
-                        {field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
-                        {field: 'amount_kill', title: __('秒杀价'), operate: 'BETWEEN'},
-                        {field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
-                        {field: 'remark', title: __('备注'), operate: 'like'},
-                        {
-                            field: 'top_time',
-                            title: __('Top_time'),
-                            //operate: 'RANGE',
-                            //addclass: 'datetimerange',
-                            autocomplete: false,
-                            /* formatter(a, b, c) {
-                                 return `<a data-toggle="switcher" class="btn-switcher btn-change-top" data-id="${b.id}" data-value="${a ? a : ''}">
-                                     <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
-                                     </a>`
-                             }*/
-                            formatter: Table.api.formatter.toggle,
-                            searchList: {1:'是',0:'否'},
-                        },
-                        {
-                            field: 'rec_time',
-                            title: __('Rec_time'),
-                            //operate: 'RANGE',
-                            //addclass: 'datetimerange',
-                            autocomplete: false,
-                            /*formatter(a, b, c) {
-                                return `<a data-toggle="switcher" class="btn-switcher btn-change-rec" data-id="${b.id}" data-value="${a ? a : ''}">
-                                    <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
-                                    </a>`
-                            }*/
-                            formatter: Table.api.formatter.toggle,
-                            searchList: {1:'是',0:'否'},
-                        },
-                        //{field: 'is_hold', title: __('预占'),formatter: Table.api.formatter.toggle,searchList:{0:'否',1:'是'}},
-                        {
-                            field: 'buttons',
-                            width: "120px",
-                            title: __('操作'),
-                            table: table,
-                            events: Table.api.events.operate,
-                            operate: false,
-                            formatter: Table.api.formatter.buttons,
-                            buttons: [
-                                {
-                                    name: 'detail',
-                                    text: __('预占'),
-                                    title: __('预占'),
-                                    classname: 'btn btn-xs btn-info btn-dialog',
-                                    url: 'mobile/takeit',
-                                    callback: function (data) {
-                                    },
-                                    visible: function (row) {
-                                        return table.data('operate-mobile_takeit') && row.is_activity===0;
-                                    }
-                                },
-                                {
-                                    name: 'detail',
-                                    text: __('取消预占'),
-                                    title: __('取消预占'),
-                                    classname: 'btn btn-xs btn-warning btn-ajax',
-                                    confirm: '确认取消吗?',
-                                    url: 'mobile/activity_cancel?aaa=1',
-                                    success: function (data) {
-                                        $('.btn-refresh').trigger('click')
-                                    },
-                                    visible: function (row) {
-                                        return table.data('operate-activity_cancel') && row.is_activity===1;
-                                    },
-                                    disable(row){
-                                        return admin_Info.sub && row.hold_chan!==admin_Info.id
-                                    }
-                                },
-                                {
-                                    name: 'detail',
-                                    text: __('记录'),
-                                    title: __('记录'),
-                                    classname: 'btn btn-xs btn-info btn-dialog',
-                                    url: 'mobile_price_log/index?a=1',
-                                    callback: function (data) {
-                                    },
-                                    visible: function (row) {
-                                        return true;
-                                    }
-                                },
-                            ]
-                        },
-                        {field: 'status', title: __('号码状态'), formatter (a,b){
-                                if(b.is_activity){
-                                    return `<span style="color: red"><div>●</div>预占</span>`
-                                }else{
-                                    return mobileStatus[a]
-                                }
-                            }, searchList: mobileStatus},
-                        {
-                            field: 'update_time',
-                            title: __('Update_time'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            autocomplete: false,
-                            formatter: Table.api.formatter.datetime
+                            name: 'detail',
+                            text: __('取消预占'),
+                            title: __('取消预占'),
+                            classname: 'btn btn-xs btn-warning btn-ajax',
+                            confirm: '确认取消吗?',
+                            url: 'mobile/activity_cancel?aaa=1',
+                            success: function (data) {
+                                $('.btn-refresh').trigger('click')
+                            },
+                            visible: function (row) {
+                                return table.data('operate-activity_cancel') && row.is_activity===1;
+                            },
+                            disable(row){
+                                return admin_Info.sub && row.hold_chan!==admin_Info.id
+                            }
                         },
                         {
-                            field: 'create_time',
-                            title: __('上架时间'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            autocomplete: false,
-                            formatter: Table.api.formatter.datetime
+                            name: 'detail',
+                            text: __('记录'),
+                            title: __('记录'),
+                            classname: 'btn btn-xs btn-info btn-dialog',
+                            url: 'mobile_price_log/index?a=1',
+                            callback: function (data) {
+                            },
+                            visible: function (row) {
+                                return true;
+                            }
                         },
-                        {field: 'sort', title: __('Sort'), operate: "BETWEEN"},
-                        {field: 'hold_chan', title: __('预占通道'), operate: "="},
-                        {field: 'hold_user', title: __('预占用户ID'), operate: "="},
-                        {field: 'admin_id', title: __('上传用户'), operate: "="},
+                    ]
+                },
+                {field: 'status', title: __('号码状态'), formatter (a,b){
+                        if(b.is_activity){
+                            return `<span style="color: red"><div>●</div>预占</span>`
+                        }else{
+                            return mobileStatus[a]
+                        }
+                    }, searchList: mobileStatus},
+                {
+                    field: 'update_time',
+                    title: __('Update_time'),
+                    operate: 'RANGE',
+                    addclass: 'datetimerange',
+                    autocomplete: false,
+                    formatter: Table.api.formatter.datetime
+                },
+                {
+                    field: 'create_time',
+                    title: __('上架时间'),
+                    operate: 'RANGE',
+                    addclass: 'datetimerange',
+                    autocomplete: false,
+                    formatter: Table.api.formatter.datetime
+                },
+                {field: 'sort', title: __('Sort'), operate: "BETWEEN"},
+                {field: 'hold_chan', title: __('预占通道'), operate: "="},
+                {field: 'hold_user', title: __('预占用户ID'), operate: "="},
+                {field: 'admin_id', title: __('上传用户'), operate: "="},
 
-                        /*{field: 'name', title: __('Name')},
-                        {field: 'type', title: __('Type'),formatter: Table.api.formatter.label,searchList:no_type},
-                        {field: 'amount_exists', title: __('Amount_exists'), operate:'BETWEEN'},
-                        {field: 'amount_base', title: __('Amount_base'), operate:'BETWEEN'},
-                        {field: 'summary', title: __('Summary')},
-                        {field: 'saled', title: __('Saled'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
-                        {field: 'is_activity', title: __('Is_activity'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
-                        {field: 'activity_time_end', title: __('Activity_time_end'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
-                        {field: 'sort', title: __('Sort'),operate: "BETWEEN"},*/
+                /*{field: 'name', title: __('Name')},
+                {field: 'type', title: __('Type'),formatter: Table.api.formatter.label,searchList:no_type},
+                {field: 'amount_exists', title: __('Amount_exists'), operate:'BETWEEN'},
+                {field: 'amount_base', title: __('Amount_base'), operate:'BETWEEN'},
+                {field: 'summary', title: __('Summary')},
+                {field: 'saled', title: __('Saled'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
+                {field: 'is_activity', title: __('Is_activity'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
+                {field: 'activity_time_end', title: __('Activity_time_end'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
+                {field: 'sort', title: __('Sort'),operate: "BETWEEN"},*/
+                {
+                    field: 'operate',
+                    title: __('Operate'),
+                    table: table,
+                    events: Table.api.events.operate,
+                    formatter: Table.api.formatter.operate,
+                    buttons: [
                         {
-                            field: 'operate',
-                            title: __('Operate'),
-                            table: table,
-                            events: Table.api.events.operate,
-                            formatter: Table.api.formatter.operate,
-                            buttons: [
-                                {
-                                    name: 'detail',
-                                    text: __('记录'),
-                                    title: __('记录'),
-                                    classname: 'btn btn-xs btn-info btn-dialog',
-                                    url: 'mobile_price_log/index?a=1',
-                                    callback: function (data) {
-                                    },
-                                    visible: function (row) {
-                                        return true;
-                                    }
-                                },
-                            ]
+                            name: 'detail',
+                            text: __('记录'),
+                            title: __('记录'),
+                            classname: 'btn btn-xs btn-info btn-dialog',
+                            url: 'mobile_price_log/index?a=1',
+                            callback: function (data) {
+                            },
+                            visible: function (row) {
+                                return true;
+                            }
                         },
                     ]
+                },
+            ]
+            if(admin_Info.sub){
+                Table.api.removeColumn('proxy.nickname',columns)
+            }
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                search: false,
+                searchFormVisible: true,
+                columns: [
+                    columns
                 ]
             });
 

+ 12 - 0
public/assets/js/require-table.js

@@ -952,6 +952,18 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                     }
                 });
                 return row;
+            },
+            removeColumn(field,columns){
+                let idx=-1
+                for (let i=0;i<columns.length;i++){
+                    if(field===columns[i].field){
+                        idx=i
+                        break
+                    }
+                }
+                if(idx!==-1){
+                    columns.splice(idx,1)
+                }
             }
         },
     };