def search(cls, current_page, **search_info): """查询员工列表""" user_pro = search_info.pop('cur_user') staff_qs = user_pro._staff_qs if 'keyword' in search_info: keyword = search_info.pop('keyword') staff_qs = staff_qs.filter(Q(name__contains = keyword) | \ Q(phone__contains = keyword)) dept_staff_id = [] role_staff_id = [] d_flag = False r_flag = False if 'department' in search_info: d_flag = True dept_id = search_info.pop('department') #dept_id = [d.id for d in Department.query().filter(name__contains = dept)] #使用名称查找 dept_staff_id = [a.staff_id for a in AuthAccess.query().filter(access_id__exact = dept_id, access_type = 'department')] if 'role' in search_info: r_flag = True role_id = search_info.pop('role') #role_id = [r.id for r in Role.query().filter(name__contains = role)] #使用名称查找 role_staff_id = [a.staff_id for a in AuthAccess.query().filter(access_id__exact = role_id, access_type = 'role')] if all((d_flag, r_flag)): staff_id_list = list(set(role_staff_id).intersection(set(dept_staff_id))) staff_qs = staff_qs.filter(id__in = staff_id_list) elif not d_flag and not r_flag: pass else: staff_id_list = dept_staff_id + role_staff_id staff_qs = staff_qs.filter(id__in = staff_id_list) if 'is_working' in search_info: is_working = search_info.pop('is_working') staff_qs = staff_qs.filter(is_working = is_working) staff_qs = staff_qs.order_by("-entry_time") return Splitor(current_page, staff_qs)
def search(cls, current_page, **search_info): """查询渠道列表""" channel_qs = Channel.query(**search_info) channel_qs = channel_qs.order_by("-create_time") return Splitor(current_page, channel_qs)
def search(cls, current_page, **search_info): """售后服务单产品列表查询""" if "equipment_code" in search_info: equipment_code = search_info.pop("equipment_code") search_info.update({"equipment__code":equipment_code}) if "seller_staff_id" in search_info: seller_staff_id = search_info.pop("seller_staff_id") search_info.update({"service__seller_id":seller_staff_id}) if "server_staff_id" in search_info: server_staff_id = search_info.pop("server_staff_id") search_info.update({"service__server_id":server_staff_id}) if "shop_id" in search_info: shop_id = search_info.pop("shop_id") search_info.update({"order__shop_id":shop_id}) if "buy_date_start" in search_info: buy_date_start = search_info.pop("buy_date_start") search_info.update({"order__pay_time__gte":buy_date_start}) if "buy_date_end" in search_info: buy_date_end = search_info.pop("buy_date_end") search_info.update({"order__pay_time__lte":\ datetime.datetime(buy_date_end.year, buy_date_end.month, buy_date_end.day, 23, 59, 59)}) service_item_qs = cls.search_qs(**search_info) service_item_qs = service_item_qs.order_by("-create_time") return Splitor(current_page, service_item_qs)
def search(cls, current_page, **search_info): """查询事件列表""" staff_orser_event_qs = StaffOrderEvent.query(**search_info) staff_orser_event_qs = staff_orser_event_qs.order_by("-create_time") return Splitor(current_page, staff_orser_event_qs)
def search(cls, current_page, **search_info): """查询跟踪列表""" track_event_qs = TrackEvent.query(**search_info) track_event_qs.order_by("-create_time") return Splitor(current_page, track_event_qs)
def search(cls, current_page, **search_info): """查询别名列表""" staff_alias_qs = StaffAlias.query(**search_info) staff_alias_qs = staff_alias_qs.order_by("-create_time") return Splitor(current_page, staff_alias_qs)
def search(cls, current_page, **search_info): """查询设备列表""" equipment_qs = Equipment.search(**search_info) equipment_qs.order_by("-create_time") return Splitor(current_page, equipment_qs)
def search(cls, current_page, **search_info): """查询服务列表""" user_pro = search_info.pop('cur_user') service_qs = Service.search(**search_info) if not user_pro._is_show_sub: service_qs = service_qs.filter(seller_id__exact = user_pro._cur_user_id) if user_pro._is_admin: service_qs = Service.query() service_qs = service_qs.order_by("-create_time") return Splitor(current_page, service_qs)
def search(cls, current_page, **search_info): """查询产品列表""" if 'keyword' in search_info: keyword = search_info.pop('keyword') product_qs = Product.search(**search_info).filter(Q(name__contains = keyword) | \ Q(id__contains = keyword)) else: product_qs = Product.search(**search_info) product_qs = product_qs.order_by("-create_time") return Splitor(current_page, product_qs)
def search(cls, current_page, **search_info): """查询所有订单列表""" user_pro = search_info['cur_user'] order_qs = cls.search_qs(**search_info) if not user_pro._is_show_sub: event_id = StaffOrderEvent.query( staff_id__exact=user_pro._cur_user_id)[0].id order_qs = order_qs.filter(id__exact=event_id) order_qs = order_qs.order_by("-create_time") return Splitor(current_page, order_qs)
def search(cls, current_page, **search_info): """查询销售机会列表""" user_pro = search_info.pop('cur_user') sale_chance_qs = SaleChance.search(**search_info) if user_pro._is_admin: sale_chance_qs = SaleChance.query() today = datetime.date.today() sale_chance_qs = sale_chance_qs.filter( end_time__gte=today).order_by("end_time") sale_chance_qs = sale_chance_qs.filter( staff_id__in=user_pro._staff_id_list) return Splitor(current_page, sale_chance_qs)
def search(cls, current_page, **search_info): """查询店铺列表""" if "channel_id" in search_info: channel = ChannelServer.get(search_info["channel_id"]) search_info.update({"channel": channel}) shop_qs = Shop.query(**search_info) if "name" in search_info: keyword = search_info.pop('name') shop_qs = shop_qs.filter(Q(name__contains = keyword) \ | Q(channel__name__contains = keyword)) shop_qs = shop_qs.order_by("-create_time") return Splitor(current_page, shop_qs)
def search(cls, current_page, **search_info): """查询手机列表""" phone_qs = cls.search_qs(**search_info) if 'keyword' in search_info: keyword = search_info.pop('keyword') phone_qs = phone_qs.filter(Q(name__contains = keyword) | \ Q(phone_number__contains = keyword)) if 'mobile_code' in search_info: mobile_code = search_info.pop('mobile_code') phone_qs = phone_qs.filter(devices_id = mobile_code) phone_qs = phone_qs.order_by("-create_time") return Splitor(current_page, phone_qs)
def search(cls, current_page, **search_info): """查询手机设备维护列表""" keyword = "" if 'keyword' in search_info: keyword = search_info.pop('keyword') mobile_maintain_qs = cls.searchall(**search_info) if keyword: mobile_maintain_qs = mobile_maintain_qs.filter(Q(staff__name__contains = keyword) | \ Q(devices__code__contains = keyword)) mobile_maintain_qs = mobile_maintain_qs.order_by("-create_time") return Splitor(current_page, mobile_maintain_qs)
def search(cls, current_page, **search_info): """查询商品列表""" goods_qs = cls.search_qs(**search_info) return Splitor(current_page, goods_qs)
def search(cls, current_page, **search_info): """查询日志列表""" journal_qs = Journal.search(**search_info) return Splitor(current_page, journal_qs)
def search(cls, current_page, **search_info): """查询手机设备列表""" mobile_devices_qs = cls.searchall(**search_info) return Splitor(current_page, mobile_devices_qs)
def search(cls, current_page, report_qs): """查询店铺绩效列表""" return Splitor(current_page, report_qs)
def search(cls, current_page, measure_staff_qs): """查询员工绩效列表""" measure_staff_qs = measure_staff_qs.order_by("-report_date") return Splitor(current_page, measure_staff_qs)
def search(cls, current_page, **search_info): """查询客户列表""" customer_qs = cls.search_qs(**search_info) return Splitor(current_page, customer_qs)
def search(cls, current_page): """查询账号列表""" account_list = StaffAccount.query() return Splitor(current_page, account_list)
def search(self, current_page, **search_info): search_qs = self.search_qs(**search_info) return Splitor(current_page, search_qs)