Ejemplo n.º 1
0
def get_lib(request):
    dc = {
        'exfun':
        static_url('js/exfun.pack.js?t=%s&v=6' %
                   js_stamp_dc.get('exfun_pack_js')),
        'director':
        static_url('js/director.pack.js?t=%s&v=2' %
                   js_stamp_dc.get('director_pack_js')),
        'moment':
        '/static/lib/moment2.17.1.min.js',
        #'stompjs':'https://cdn.jsdelivr.net/npm/[email protected]/lib/stomp.min.js'
        'stompjs':
        'https://cdn.bootcdn.net/ajax/libs/stomp.js/2.3.3/stomp.min.js'
    }
    if request.META.get('ACCESS_FROM_INTERNET'):
        dc.update({
            'moment':
            'https://cdn.jsdelivr.net/npm/[email protected]/moment.min.js',
            'moment_zh_cn':
            'https://cdn.jsdelivr.net/npm/[email protected]/locale/zh-cn.js',
            'stompjs':
            'https://cdn.bootcdn.net/ajax/libs/stomp.js/2.3.3/stomp.min.js'
        })

    return dc
Ejemplo n.º 2
0
def get_lib(request):

    dc = {
        'ui_editor':
        static_url('js/ui_editor.pack.js?t=%s' %
                   js_stamp_dc.get('ui_editor_pack_js')),
        'uie_init':
        static_url('js/uie_init.pack.js?t=%s' %
                   js_stamp_dc.get('uie_init_pack_js')),
    }
    return dc
Ejemplo n.º 3
0
def get_lib(request):
    dc = {
        'zhaoxiang':
        '/static/js/zhaoxiang.pack.js?t=%s' %
        js_stamp_dc.get('zhaoxiang_pack_js'),
    }
    return dc
Ejemplo n.º 4
0
def get_lib(request):
    dc = {
        'myagora':
        '/static/js/myagora.pack.js?t=%s&v=1' %
        js_stamp_dc.get('myagora_pack_js'),
    }
    return dc
Ejemplo n.º 5
0
def get_lib(request):
    dc = {
        'yun_wu_you':
        '/static/js/yun_wu_you.pack.js?t=%s' %
        js_stamp_dc.get('yun_wu_you_pack_js'),
    }
    return dc
Ejemplo n.º 6
0
def get_lib(request):
    dc = {
        'expolink_pack_js':
        '/static/js/expolink.pack.js?t=%s' %
        js_stamp_dc.get('expolink_pack_js'),
        #'jquery': '/static/lib/jquery3.2.1.min.js',
        #'font_awesome': '/static/lib/font-awesome4.7/font-awesome4.7.min.css',
        #'bootstrap_css': '/static/lib/bootstrap.min.css',
        #'bootstrap': '/static/lib/bootstrap.min.js',
        #'nice_validator': 'https://cdn.bootcss.com/nice-validator/1.1.3/jquery.validator.min.js?local=zh-CN',
        #'nice_validator_css': 'https://cdn.bootcss.com/nice-validator/1.1.3/jquery.validator.min.css',

        ##'exfun': '/static/js/exfun.pack.js',
        ##'director': '/static/js/director.pack.js',

        #'adminlte': 'https://cdn.bootcss.com/admin-lte/2.4.3/js/adminlte.min.js',
        #'adminlte_css': 'https://cdn.bootcss.com/admin-lte/2.4.3/css/AdminLTE.min.css',
        #'adminlte_blue_css': 'https://cdn.bootcss.com/admin-lte/2.4.3/css/skins/skin-blue.min.css',

        #'nprogress': 'https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js',
        #'nprogress_css': 'https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css',
        #'layer': 'https://cdn.bootcss.com/layer/3.1.0/layer.js',
        #'layer_css':'https://cdn.bootcss.com/layer/3.1.0/theme/default/layer.css',
        #'element': 'https://cdn.bootcss.com/element-ui/2.4.0/index.js',  #'https://unpkg.com/element-ui/lib/index.js',
        #'element_css':'https://cdn.bootcss.com/element-ui/2.4.0/theme-chalk/index.css',  # 'https://unpkg.com/element-ui/lib/theme-chalk/index.css',
        #'md5': 'https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js',
        #'jb_admin_pack_js': '/static/js/jb_admin.pack.js?t=%s'%js_stamp_dc.get('jb_admin_pack_js'),
    }
    return dc
Ejemplo n.º 7
0
def get_lib(request):

    dc = {
        'color':
        '/static/js/color.pack.js?t=%s' % js_stamp_dc.get('color_pack_js'),
    }
    return dc
Ejemplo n.º 8
0
def get_lib(request):
    dc = {
        'bigscreen':
        '/static/js/bigscreen.pack.js?t=%s' %
        js_stamp_dc.get('bigscreen_pack_js'),
    }
    return dc
Ejemplo n.º 9
0
def get_lib(request):

    dc = {
        'data_chart':
        static_url('js/data_chart.pack.js?t=%s' %
                   js_stamp_dc.get('data_chart_pack_js')),
    }
    return dc
Ejemplo n.º 10
0
def get_lib(request):

    dc = {
        'order_dinner':
        static_url('js/order_dinner.pack.js?t=%s' %
                   js_stamp_dc.get('order_dinner_pack_js')),
    }
    return dc
Ejemplo n.º 11
0
def get_lib(request): 
    dc = {        
        'authuser': '******'%js_stamp_dc.get('authuser_pack_js'),
    }
    return dc
Ejemplo n.º 12
0
def get_lib(request): 
    dc = {
        'xingyue': '/static/js/xingyue.pack.js?t=%s&v=21'%js_stamp_dc.get('xingyue_pack_js'),
    }
    return dc
Ejemplo n.º 13
0
class KeyRegionStatic(TablePage):
    template = 'jb_admin/table.html'
    extra_js=['/static/js/key_region.pack.js?t=%s'%js_stamp_dc.get('key_region_pack_js','')]
    def get_label(self): 
        return '关键区域案件统计'
    
    class tableCls(ModelTable):
        model = BlockPolygon
        #fiel = ['loc', 'org_code', 'id']
        include = ['name']
        
        #def __init__(self, _page=1, row_sort=[], row_filter={}, row_search='', crt_user=None, perpage=None, **kw): 
            #page_dc
        
        @classmethod
        def clean_search_args(cls, search_args):
            if '_start_subtime' not in  search_args.keys() and '_end_subtime' not in search_args.keys():
                today =datetime.now()
                day_30_ago = today-timedelta(days=30)                
                search_args['_start_subtime']= day_30_ago.strftime('%Y-%m-%d 00:00:00')
                search_args['_end_subtime'] =today.strftime('%Y-%m-%d 23:59:59') 
            return search_args        
        
        def getExtraHead(self): 
            return [
                 {'name': 'total','label': '案件数',}, 
                 {'name': '0','label': '第一类案件','width':100,'editor':'com-table-case-num-type'}, 
                 {'name': '1','label': '第二类案件','width':100,'editor':'com-table-case-num-type'}, 
                 {'name': '2','label': '第三类案件','width':100,'editor':'com-table-case-num-type'}, 
                 {'name': '3','label': '第四类案件','width':100,'editor':'com-table-case-num-type'}, 
                 {'name': '4','label': '第五类案件','width':100,'editor':'com-table-case-num-type'}, #com-table-html-shower 
                 {'name': '5','label': '其他',}, 
                 {'name': 'nums_bujian','label': '部件',}, 
                 {'name': 'nums_shijian','label': '事件',}, 
                 {'name': 'jie_ratio','label': '结案率',}
            ]
        #def get_heads(self): 
            #return [
            #{'name': 'region','label': '区域',}, 
            #]
        def dict_head(self, head):
            if head['name']=='name':
                head['width']=140
            return head
        
        def inn_filter(self, query): 
            return query.filter(blockgroup__belong = 'keyAera')
        
        def dict_row(self, inst): 
            poly = inst.bounding
            search_args = self.kw.get('search_args')
            if search_args:
                start = search_args.get('_start_subtime','')
                end =  search_args.get('_end_subtime','')
                qq = JianduCase.objects.filter(loc__intersects = poly,subtime__lte=end,subtime__gte=start)
            else:
                qq = JianduCase.objects.filter(loc__intersects = poly)
            total = qq.count()
            jie_total = qq.filter(status = 9).count()
            
            q1 = qq.values('litclass').annotate(nums_case = Count('id')).order_by('-nums_case')
            out = {}
            pre_num_case = 0
            for index, case in enumerate(q1):
                pre_num_case += case.get('nums_case')
                out[str(index)] = '%s/%s'% (case.get('nums_case'), case.get('litclass') )
                #out[str(index)] = '''<div style="text-align:center"><span>%s</span><br><span style="color:gray;font-size:70%%;">%s</span></div>''' \
                    #% (case.get('nums_case'), case.get('litclass') )
                if index >= 5:
                    out['5'] = total - pre_num_case
                    break
            bujian = qq.aggregate(nums_bujian = Count(Case(When(infotypeid = 0, then= 1))), \
                                  nums_shijian = Count(Case(When(infotypeid = 1, then= 1))))          
            out.update(bujian)
            if total == 0:
                jie_ratio = '0'
            else:
                jie_ratio = '%s%%' % round(100.0 * jie_total / total, 2)
            out.update({
                 'total': total,
                 'jie_ratio': jie_ratio,
            })
            
            return out
        
        
        #def get_query(self): 
            #ls = []
            #for row in JianduCase.objects.all().values('keepersn').annotate(nums_case = Count('id')):
                #ls.append(row)
            #return ls
            
        #def statistics(self, query): 
            #"""
            #"""
            #return query.values('keepersn', 'keepersn__name').exclude(Q(status = 5) | Q(status = 10))\
                   #.annotate(nums_case = Count('id'))\
                   #.annotate(nums_simple = Count(Case(When(Q(deptcode = F('executedeptcode')) & Q( deptcode = '20601'), then= 1)) ))\
                   #.annotate(nums_normal = F('nums_case') - F('nums_simple'))\
                   #.annotate(nums_bujian = Count(Case(When(infotypeid = 0, then= 1))))\
                   #.annotate(nums_shijian = Count(Case(When(infotypeid = 1, then= 1))))\
        def get_operation(self):
            ops = super().get_operation()
            ops.extend([
                 {'fun': 'export_excel', 'editor': 'com-op-btn', 'label': '导出Excel', 'icon': 'fa-file-excel-o', }
            ])
            return ops
        
        class filters(RowFilter):
            range_fields = ['subtime']
            def getExtraHead(self):
                return [
                    {'name': 'subtime', 'label': '发现时间', 'editor': 'com-date-datetimefield-range-filter'}
                ]
            
            def get_query(self, query):
                return query
Ejemplo n.º 14
0
def get_lib(request):

    dc = {
        'job': '/static/js/job.pack.js?t=%s' % js_stamp_dc.get('job_pack_js'),
    }
    return dc
Ejemplo n.º 15
0
def get_lib(request):
    dc = {
        'welljia':
        '/static/js/welljia.pack.js?t=%s' % js_stamp_dc.get('welljia_pack_js'),
    }
    return dc
Ejemplo n.º 16
0
class SiteRegistFormPage(RegistFormPage):
    extra_js = [
        '/static/js/welljia.pack.js?t=%s' % js_stamp_dc.get('welljia_pack_js')
    ]

    class fieldsCls(RegistFormPage.fieldsCls):
        field_sort = [
            'phone', 'password', 'phone_code', 'nickname', 'invite_code'
        ]

        def getExtraHeads(self):

            return [
                #{'name': 'pswd2','label': '确认密码','editor': 'password', 'required': True,'fv_rule': 'match(password)',},
                {
                    'name': 'phone',
                    'label': '手机号',
                    'editor': 'number',
                    'placeholder': '作为账号ID登录',
                    'required': True,
                    'fv_rule': 'mobile',
                },
                {
                    'name': 'phone_code',
                    'label': '验证码',
                    'editor': 'com-field-phone-code',
                    'required': True,
                    'phone_field': 'phone',
                    'fun': 'regist_send_phone_code',
                },
                {
                    'name': 'nickname',
                    'label': '昵称',
                    'editor': 'linetext',
                },
                {
                    'name': 'invite_code',
                    'label': '邀请码',
                    'editor': 'com-field-invite-code',
                    'key': 'invite_code',
                },
            ]

        def clean_dict(self, dc):
            dc['username'] = "******" % (get_str(6), abs(hash(timezone.now)))
            return dc

        def dict_head(self, head):
            super().dict_head(head)
            if head['name'] == 'email':
                head['required'] = True
            return head

        #def clean_email(self):
        #email = self.cleaned_data.get('email')
        #if User.objects.filter(email=email).exists():
        #raise forms.ValidationError('该邮箱已经被申请')
        #return email

        def clean(self):
            if 'pswd2' in self.cleaned_data:
                del self.cleaned_data['pswd2']
            phone = self.kw.get('phone')
            phone_code = self.kw.get('phone_code')

            if UserInfo.objects.filter(phone=phone).exists():
                self._errors['phone'] = ['该手机已经被注册']
                return

            #email = self.cleaned_data.get('email')
            #if User.objects.filter(email=email).exists():
            #self._errors['email'] = ('该邮箱已经被申请')
            #return
            if self.kw.get('invite_code'):
                try:
                    info = UserInfo.objects.get(
                        invite_code=self.kw.get('invite_code'))
                    self.invite_user = info.user
                except UserInfo.DoesNotExist:
                    self._errors['invite_code'] = ['邀请码不存在']
            else:
                self.invite_user = None

            if not validate_phone_code(phone, phone_code):
                self._errors['phone_code'] = ['验证码不存在或者已经过期']
            return self.cleaned_data

        def clean_save(self):
            user = self.instance
            user.set_password(self.kw.get('password'))
            user.is_active = True
            invite_code = get_str(length=6).lower()
            UserInfo.objects.create(user=user,
                                    phone=self.kw.get('phone'),
                                    nickname=self.kw.get('nickname', ''),
                                    invite_code=invite_code,
                                    invite_by=self.invite_user)

    @staticmethod
    def send_phone_code(row):
        code = make_phone_validate_code(row['phone'])
        log.info('手机号:%(phone)s生成验证码%(code)s' % {
            'phone': row['phone'],
            'code': code,
        })
        phone = row.get('phone')
        print(code)
        send_validate_code(phone, code)
        return {
            'row': row,
        }
Ejemplo n.º 17
0
class TaskPage(TablePage):
    template='jb_admin/table.html'
    extra_js=['/static/js/zhongbo.pack.js?t=%s'%js_stamp_dc.get('zhongbo_pack_js','')]
    
    def get_label(self):
        return '案件列表'
    
    class tableCls(ModelTable):
        """
        三高task地址: http://10.231.18.25/CityGrid/CaseOperate_flat/ParticularDisplayInfo.aspx?categoryId=undefined&taskid=1806B1651274
        """
        model=TBTaskBridge
        exclude=[]
        pop_edit_field='detail'
        fields_sort=['yuan_eventNum','san_taskid','yuan_occurredStr','address','event_content', 'status','yuan_status', 'san_status',
                     'san_remark', 'create_time','loc','detail']
        def get_operation(self):
            opes = super().get_operation()
            ls = [
                {'fun': 'updateFromYuan', 'editor': 'com-op-btn', 'label': '从远景系统更新案件', 'icon': 'fa-handshake-o',}, 
                {'fun':'putTaskIntoSangao','editor':'com-op-btn','label':'导入网格化系统','style': 'color:green','icon': 'fa-handshake-o','disabled':'!has_select'},
                {'fun': 'updateFromSan', 'editor': 'com-op-btn', 'label': '从网格化更新案件', 'icon': 'fa-handshake-o','disabled':'!has_select'}, 
                {'fun': 'taskToYuanjing', 'editor': 'com-op-btn', 'label': '反馈回远景系统', 'icon': 'fa-handshake-o','disabled':'!has_select'}
               ]
            opes.extend(ls)
            return opes
        
        def getExtraHead(self):
            return [{
                'name':'detail',
                'label':'',
                'show_label':{
                    'fun':'text_label',
                    'text':'详情' 
                }
            }]

      
        def dict_head(self, head):
            dc={
                'yuan_eventNum':120,
                'san_taskid': 110,
                'address':150,
                'event_content':150,
            }
            head['width']=dc.get(head['name'],100)
            if head['name'] == 'san_taskid':
                head['editor'] = 'com-table-jump-link'
                head['link_field'] = '_sangao_link'
            return head
        
        def dict_row(self, inst): 
            return {
                '_sangao_link': 'http://10.231.18.25/CityGrid/CaseOperate_flat/ParticularDisplayInfo.aspx?categoryId=undefined&taskid=' + inst.san_taskid,
            }
        
        def inn_filter(self, query):
            return query.order_by('-pk')
            #return query.order_by('-yuan_occurredStr')
        
        def get_context(self):
            ctx = ModelTable.get_context(self)
            ctx['extra_table_logic'] = 'zhongbo_logic'
            return ctx
        
        class filters(RowFilter):
            model=TBTaskBridge
            names=['yuan_status']
            range_fields=['yuan_occurredStr']
        class sort(RowSort):
            names=['yuan_occurredStr']
        
        class search(RowSearch):
            names=['yuan_eventNum']
Ejemplo n.º 18
0
def get_lib(request):
    jsdeliver_crack = True

    if settings.DEBUG:
        vue = static_url('lib/vue2.6/vue.js')
    else:
        vue = static_url('lib/vue2.6/vue.min.js')

    dc = {
        'jquery':
        static_url('lib/jquery3.2.1.min.js'),
        'vuejs':
        vue,
        'vuex':
        static_url('lib/vuex.min.js'),
        'font_awesome':
        '/static/lib/font-awesome4.7/font-awesome4.7.min.css',
        'bootstrap_css':
        '/static/lib/bootstrap.min.css',
        'bootstrap':
        '/static/lib/bootstrap.min.js',
        'layer':
        '/static/lib/layer/layer.js',
        'layer_css':
        '/static/lib/layer/theme/default/layer.css',
        'nice_validator':
        '/static/lib/nice-validator1.14/dist/jquery.validator.min.js?local=zh-CN',
        'nice_validator_css':
        '/static/lib/nice-validator1.14/dist/jquery.validator.css',
        #'nice_validator':'https://cdn.staticfile.org/nice-validator/1.1.4/jquery.validator.min.js?local=zh-CN',
        #'nice_validator_css': 'https://cdn.staticfile.org/nice-validator/1.1.4/jquery.validator.min.css',

        #'adminlte': 'https://cdn.staticfile.org/admin-lte/2.4.3/js/adminlte.min.js',
        #'adminlte_css': 'https://cdn.staticfile.org/admin-lte/2.4.3/css/AdminLTE.min.css',
        #'adminlte_blue_css': 'https://cdn.staticfile.org/admin-lte/2.4.3/css/skins/skin-blue.min.css',
        #'adminlte': '/static/lib/adminlte/dist/js/adminlte.min.js',
        #'adminlte_css': '/static/lib/adminlte/dist/css/AdminLTE.min.css',
        #'adminlte_blue_css': '/static/lib/adminlte/dist/css/skins/skin-blue.min.css',
        'nprogress':
        '/static/lib/nprogress/nprogress.min.js',
        'nprogress_css':
        '/static/lib/nprogress/nprogress.min.css',
        'element':
        '/static/lib/element/index.js?v=2.15.7',
        'element_css':
        '/static/lib/element/index.css?v=2.15.7',
        #'element': 'https://cdn.staticfile.org/element-ui/2.4.0/index.js',
        #'element_css':'https://cdn.staticfile.org/element-ui/2.4.0/theme-chalk/index.css',

        #'md5': 'https://cdn.staticfile.org/blueimp-md5/2.10.0/js/md5.min.js',
        'md5':
        '/static/lib/md5.min.js',

        # 下面是bootcss 的cdn ,但是 不是很稳定
        #'nice_validator': 'https://cdn.bootcss.com/nice-validator/1.1.3/jquery.validator.min.js?local=zh-CN',
        #'nice_validator_css': 'https://cdn.bootcss.com/nice-validator/1.1.3/jquery.validator.min.css',
        'adminlte':
        '/static/lib/adminlte2.4.10/dist/js/adminlte.min.js',
        'adminlte_css':
        '/static/lib/adminlte2.4.10/dist/css/AdminLTE.min.css',
        'adminlte_them_css':
        '/static/lib/adminlte2.4.10/dist/css/skins/_all-skins.min.css',
        #'adminlte_css': 'https://cdn.bootcss.com/admin-lte/2.4.3/css/AdminLTE.min.css',
        #'adminlte_blue_css': 'https://cdn.bootcss.com/admin-lte/2.4.3/css/skins/skin-blue.min.css',

        #'nprogress': 'https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js',
        #'nprogress_css': 'https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css',

        #'element': 'https://cdn.bootcss.com/element-ui/2.4.0/index.js',  #'https://unpkg.com/element-ui/lib/index.js',
        #'element_css':'https://cdn.bootcss.com/element-ui/2.4.0/theme-chalk/index.css',  # 'https://unpkg.com/element-ui/lib/theme-chalk/index.css',
        #'md5': 'https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js',

        #'jb_admin_pack_js': '/static/js/jb_admin.pack.js?t=%s&t2=123'%js_stamp_dc.get('jb_admin_pack_js'),
        'jb_admin':
        static_url('js/jb_admin.pack.js?t=%s&t2=123' %
                   js_stamp_dc.get('jb_admin_pack_js')),
        #'fields':static_url( 'js/fields.pack.js?t=%s'%js_stamp_dc.get('fields_pack_js') ),
        #'swiper': 'https://cdn.bootcss.com/Swiper/4.3.0/js/swiper.min.js',
        #'swiper_css': 'https://cdn.bootcss.com/Swiper/4.3.0/css/swiper.min.css',
        'select2':
        '/static/lib/select2-4.0.10/dist/js/select2.min.js',
        'select2_css':
        '/static/lib/select2-4.0.10/dist/css/select2.min.css',
        'swiper':
        '/static/lib/swiper/js/swiper.min.js',
        'swiper_css':
        '/static/lib/swiper/css/swiper.min.css',
        'echarts':
        '/static/lib/echarts.min.js',
        'chosen':
        '/static/lib/chosen_v1.8.7/chosen.jquery.min.js',
        'chosen_css':
        '/static/lib/chosen_v1.8.7/chosen.min.css',
        'ckeditor':
        '/static/lib/ckeditor_4.10.1/ckeditor/ckeditor.js',
        'notify':
        'https://cdn.jsdelivr.net/npm/@wcjiang/[email protected]/dist/notify.min.js',
        'sortablejs':
        'https://cdn.jsdelivr.net/npm/[email protected]/Sortable.min.js',
        'selectizejs':
        'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/standalone/selectize.min.js',  # 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/selectize.min.js',
        #'selectizejs_css':'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/selectize.css',
        'selectizejs_css':
        'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/selectize.default.css',
        'cropper_css':
        '/static/lib/cropper2.3.4.min.css',
        'cropper':
        '/static/lib/cropper2.3.4.min.js',
        # 这里需要更新
        'composition_api':
        '/static/lib/vue_lib/[email protected]',
        'vuedraggable':
        'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuedraggable.umd.min.js',  # 'https://cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js'
    }
    if request.META['ACCESS_FROM_INTERNET']:

        dc.update({
            'vuejs':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js',
            #'vuejs':   'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js',
            #'jquery':'https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js',
            'jquery':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js',
            'vuex':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex.min.js',
            'font_awesome':
            'https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css',
            'bootstrap_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css',
            'bootstrap':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js',
            'layer':
            'https://cdn.jsdelivr.net/npm/[email protected]/src/layer.min.js',
            'layer_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/src/theme/default/layer.css',
            'nice_validator':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.validator.min.js?local=zh-CN',
            'nice_validator_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.validator.css',
            'adminlte':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/adminlte.min.js',
            'adminlte_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/AdminLTE.min.css',
            #'adminlte_them_css':'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/skins/skin-blue.min.css',
            'adminlte_them_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/skins/_all-skins.min.css',
            'nprogress':
            'https://cdn.jsdelivr.net/npm/[email protected]/nprogress.min.js',
            'nprogress_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/nprogress.css',

            #'element': 'https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js',
            #'element_css':'https://cdn.jsdelivr.net/npm/[email protected]/lib/theme-chalk/index.css',
            'element':
            'https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js',
            'element_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/lib/theme-chalk/index.css',
            'md5':
            'https://cdn.jsdelivr.net/npm/[email protected]/js/md5.min.js',
            'swiper':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/swiper.min.js',
            'swiper_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/swiper.min.css',
            'echarts':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js',  #'https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js',
            'chosen':
            'https://cdn.jsdelivr.net/npm/[email protected]/chosen.jquery.min.js',
            'chosen_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/chosen.min.css',
            #'ckeditor':'https://cdn.jsdelivr.net/npm/[email protected]/ckeditor.js',
            #'ckeditor':'https://cdn.jsdelivr.net/npm/[email protected]/ckeditor.min.js',
            'ckeditor':
            'https://cdn.jsdelivr.net/gh/coblan/[email protected]/ckeditor_4.10.1/ckeditor/ckeditor.js',  #'https://cdn.ckeditor.com/4.10.1/full/ckeditor.js',
            #'ckeditor':'https://cdn.jsdelivr.net/npm/[email protected]/ckeditor.js',
            'select2':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js',
            'select2_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css',
            'cropper_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/cropper.min.css',
            'cropper':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/cropper.min.js',
            'velocity':
            'https://cdn.jsdelivr.net/npm/[email protected]/velocity.min.js',
            'animate_css':
            'https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css',
            'wow':
            'https://cdn.jsdelivr.net/npm/[email protected]/dist/wow.min.js',
            'composition_api':
            'https://cdn.jsdelivr.net/npm/@vue/[email protected]',
            'jsoneditor':
            'https://lib.baomitu.com/jsoneditor/9.7.4/jsoneditor.min.js',
            'jsoneditor_css':
            'https://lib.baomitu.com/jsoneditor/9.7.4/jsoneditor.min.css',
        })

        #if not settings.DEBUG:
        #dc.update({
        #'vue':'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js'
        #})

        if jsdeliver_crack:
            dc.update({
                'vuejs':
                'https://lib.baomitu.com/vue/2.6.14/vue.js',
                'jquery':
                'https://lib.baomitu.com/jquery/3.4.1/jquery.min.js',  #  'https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.4.1/jquery.min.js',
                #'vuex': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex.min.js',
                'font_awesome':
                'https://lib.baomitu.com/font-awesome/4.7.0/css/font-awesome.min.css',  #'https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/4.7.0/css/font-awesome.min.css',
                'bootstrap_css':
                'https://lib.baomitu.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css',
                'bootstrap':
                'https://lib.baomitu.com/twitter-bootstrap/3.3.7/js/bootstrap.min.js',
                'layer':
                'https://lib.baomitu.com/layer/3.1.1/layer.min.js',  #  'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.1.1/layer.min.js',
                'layer_css':
                'https://lib.baomitu.com/layer/3.1.1/mobile/need/layer.min.css',  # 'https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.1.1/mobile/need/layer.min.css', 
                'nice_validator':
                'https://lib.baomitu.com/nice-validator/1.1.4/jquery.validator.min.js?local=zh-CN',  # 'https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/nice-validator/1.1.4/jquery.validator.min.js?local=zh-CN',
                'nice_validator_css':
                'https://lib.baomitu.com/nice-validator/1.1.4/jquery.validator.min.css',  # 'https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/nice-validator/1.1.4/jquery.validator.min.css',
                'adminlte':
                'https://lib.baomitu.com/admin-lte/2.4.18/js/adminlte.min.js',  # 'https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-y/admin-lte/2.4.10/js/adminlte.min.js',
                'adminlte_css':
                'https://lib.baomitu.com/admin-lte/2.4.18/css/AdminLTE.min.css',  # 'https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-y/admin-lte/2.4.10/css/AdminLTE.min.css',
                'adminlte_them_css':
                'https://lib.baomitu.com/admin-lte/2.4.18/css/skins/_all-skins.min.css',  # 'https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-y/admin-lte/2.4.10/css/skins/_all-skins.min.css',
                'nprogress':
                'https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js',  #  'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/nprogress/0.2.0/nprogress.min.js',
                'nprogress_css':
                'https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css',  # 'https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-y/nprogress/0.2.0/nprogress.min.css',   

                #'element': 'https://lib.baomitu.com/element-ui/2.15.8/index.min.js',
                #'element_css':'https://lib.baomitu.com/element-ui/2.15.8/theme-chalk/index.min.css',
                # 360总element可能显示icon有问题,替换成字节的
                #'element':'https://cdn.bytedance.com/cdn/expire-1-M/element-ui/2.15.7/index.min.js',
                #'element_css':'https://cdn.bytedance.com/cdn/expire-1-M/element-ui/2.15.7/theme-chalk/index.min.css',
                'element':
                'https://s1.pstatp.com/cdn/element-ui/2.15.7/index.min.js',
                'element_css':
                'https://s1.pstatp.com/cdn/element-ui/2.15.7/theme-chalk/index.min.css',
                'md5':
                'https://lib.baomitu.com/blueimp-md5/2.19.0/js/md5.min.js',
                'swiper':
                'https://lib.baomitu.com/Swiper/4.5.1/js/swiper.min.js',
                'swiper_css':
                'https://lib.baomitu.com/Swiper/4.5.1/css/swiper.min.css',
                'echarts':
                'https://lib.baomitu.com/echarts/5.2.2/echarts.min.js',  #'https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js',
                'chosen':
                'https://cdn.jsdelivr.net/npm/[email protected]/chosen.jquery.min.js',
                'chosen_css':
                'https://cdn.jsdelivr.net/npm/[email protected]/chosen.min.css',
                'ckeditor':
                'https://lib.baomitu.com/ckeditor/4.10.1/ckeditor.js',  #
                'select2':
                'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js',
                'select2_css':
                'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css',
                'cropper_css':
                'https://cdn.jsdelivr.net/npm/[email protected]/dist/cropper.min.css',
                'cropper':
                'https://cdn.jsdelivr.net/npm/[email protected]/dist/cropper.min.js',
                'velocity':
                'https://cdn.jsdelivr.net/npm/[email protected]/velocity.min.js',
                # 版本有兼容问题
                'animate_css':
                'https://lib.baomitu.com/animate.css/4.1.1/animate.min.css',
                #'animate_css':'https://lib.baomitu.com/animate.css/3.7.2/animate.min.css',
                'wow':
                'https://cdn.jsdelivr.net/npm/[email protected]/dist/wow.min.js',
                #'composition_api':'https://cdn.jsdelivr.net/npm/@vue/[email protected]',
                'composition_api':
                '/static/cdn/jb_admin/[email protected]',
                ##'composition_api':'https://cdn.jsdelivr.net/npm/@vue/[email protected]'
                'axios':
                'https://lib.baomitu.com/axios/0.26.1/axios.min.js',
                'ace':
                'https://lib.baomitu.com/ace/1.5.3/ace.min.js',
                'ace_javascript':
                'https://lib.baomitu.com/ace/1.5.3/mode-javascript.min.js',
            })
            if not settings.DEBUG:
                dc.update({
                    #'vue':'https://lib.baomitu.com/vue/2.6.10/vue.min.js',
                    'vuejs':
                    'https://lib.baomitu.com/vue/2.6.14/vue.min.js',
                    #'vuejs_dev':'https://lib.baomitu.com/vue/2.6.14/vue.js', # 展示还没用,试试 vue.DEBUG=True
                })

        # 由于早期没有ui_theme属性,方式用到了jb_admin作为管理界面的,默认加上skin-blue作为其主题
        #request.META['ENGIN'].ui_theme = request.META['ENGIN'].ui_theme or 'skin-blue'
        #if request.META['ENGIN'].ui_theme:
        #admin_theme_dc = {
        #'skin-black':'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/skins/skin-black.min.css',
        #'skin-blue': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/skins/skin-blue.min.css',
        #'skin-red': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/skins/skin-red.min.css',
        #'skin-green': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/skins/skin-green.min.css',
        #}
        #dc.update({
        #'adminlte_them_css':admin_theme_dc.get( request.META['ENGIN'].ui_theme  )
        #})

    return dc
Ejemplo n.º 19
0
class CasePage(TablePage):
    template = 'jb_admin/table.html'
    extra_js = [
        '/static/js/enterprise_case.pack.js?t=%s' %
        js_stamp_dc.get('enterprise_case_pack_js', '')
    ]

    def get_label(self):
        return '案件列表'

    class tableCls(ModelTable):
        pop_edit_field = 'taskid'
        model = TTaskinfo
        exclude = []
        fields_sort = [
            'taskid', 'deptname', 'address', 'description',
            'enterpriseinvoledname', 'ENT_NAME', 'discovertime'
        ]

        #def inn_filter(self, query):
        #return query.select_related('enterprise')
        def inn_filter(self, query):
            if self.crt_user.is_superuser:
                return query
            else:
                permit_names = user_permit_names(self.crt_user)
                code_list = []
                for name in permit_names:
                    mt = re.search('^street\.(\d+)\.case$', name)
                    if mt:
                        code_list.append(mt.group(1))
                return query.filter(streetcode__in=code_list)

        def getExtraHead(self):
            return [{
                'name': 'ENT_NAME',
                'label': '企业名称',
            }]

        def dict_head(self, head):
            dc = {
                'taskid': 150,
                'deptname': 140,
                'address': 160,
                'enterpriseinvoledname': 160,
                'description': 200,
                'ENT_NAME': 160,
                'discovertime': 130,
            }
            if dc.get(head['name']):
                head['width'] = dc.get(head['name'])

            return head

        def dict_row(self, inst):
            if inst.enterprise:
                dc = {
                    'ENT_NAME': inst.enterprise.ENT_NAME,
                    'DOM': inst.enterprise.DOM,
                    'REG_NO': inst.enterprise.REG_NO,
                    'UNI_SCID': inst.enterprise.UNI_SCID,
                    'NEIGHBOR': inst.enterprise.NEIGHBOR,
                }
            else:
                dc = {}
            return dc

        def get_operation(self):
            return [
                {
                    'fun': 'director_call',
                    'director_name': 'update_case_from_sangao',
                    'confirm_msg': '确认马上从网格化更新案件吗?',
                    'label': '从网格化更新案件',
                    'after_call': 'refresh',
                    'editor': 'com-op-btn',
                },
            ]

        @staticmethod
        def update_case_from_sangao():
            count = pull_task()
            return {
                'msg': '成功新建%s条案件!' % count,
            }

        class search(RowSearch):
            names = ['taskid', 'enterpriseinvoledname']

        class filters(RowFilter):
            names = ['deptname']

            def getExtraHead(self):
                options = [{
                    'value': x.ENT_NAME,
                    'label': x.ENT_NAME
                } for x in Enterprise.objects.all()]
                return [{
                    'name': 'ENT_NAME',
                    'label': '企业名称',
                    'editor': 'com-filter-select',
                    'options': options,
                }]

            def clean_query(self, query):
                if self.kw.get('ENT_NAME'):
                    return query.filter(
                        enterprise__ENT_NAME=self.kw.get('ENT_NAME'))
                else:
                    return query