Beispiel #1
0
class RouterNewForm(FormPro):
    cityid = SelectFieldPro(u'所属地市', choices=lambda: area_choices(1, u'请选择地市'))
    town = SelectFieldPro(u'', choices=lambda: area_choices(2, u'请选择区县'))
    area_id = SelectFieldPro(u'所属区域',
                             validators=[required(message=u'必填')],
                             choices=lambda: area_choices(4, u'请选择接入点'))
    name = TextField(u'路由器名称', validators=[required(message=u'必填')])
    alias = TextField(u'路由器别名', validators=[required(message=u'必填')])
    addr = TextField(u'IP 地址',
                     validators=[
                         required(message=u'必填'),
                         IPAddress(message=u'IP地址格式不正确'),
                         NoneOf(['0.0.0.0', '255.255.255.255'],
                                message=u'IP地址格式不正确')
                     ])
    snmp_comm = TextField(u'读团体名', validators=[required(message=u'必填')])
    snmp_wcomm = TextField(u'写团体名', validators=[required(message=u'必填')])
    snmp_ver = RadioField(u'SNMP版本',
                          default=SNMP_VER_DICT.keys()[0],
                          validators=[required(message=u'必填')],
                          choices=[(value, label)
                                   for value, label in SNMP_VER_DICT.items()])
    mask = TextField(u'子网掩码')
    location = TextField(u'位置')
    remark = TextAreaField(u'备注信息')
Beispiel #2
0
class NodeSearchForm(FormPro):
    keyword = TextField()
    name = TextField(u'IP 地址')
    area = AreaSelectField(u'所属区域')
    category_id = SelectFieldPro(
        u'节点类型',
        choices=lambda: [('', u'请选择节点类型')] + [
            (unicode(r.id), r.alias) for r in Category.query.filter(
                Category.obj == "node").filter(Category.is_valid == 1)
        ])
    vendor_id = SelectFieldPro(
        u'生产厂商',
        choices=lambda: [('', u'请选择生产厂商')] + [(unicode(r.id), r.alias)
                                              for r in Vendor.query])
    model_id = SelectFieldPro(
        u'设备型号',
        choices=lambda: [('', u'请选择设备型号')] + [(unicode(r.id), r.alias)
                                              for r in Model.query])
    status = SelectFieldPro(
        u'状态', choices=lambda: [('', u'请选择状态')] + NODE_STATUS_DICT.items())

    class Meta():
        attrs = Attrs(
            label={
                'style': 'width:80px;text-align: right;padding-bottom: 10px;'
            },
            field={'style': 'padding-left: 10px;padding-bottom: 10px;'})
        list_display = ('area', 'category_id', 'vendor_id', 'model_id')
Beispiel #3
0
class CpeNewForm(FormPro):
    ctrl_id = SelectFieldPro(u'所属EOC',
                             validators=[required(message=u'必填')],
                             choices=lambda: eoc_choices(3, u'请选择EOC'))
    area_id = SelectFieldPro(u'接入点',
                             validators=[required(message=u'必填')],
                             choices=lambda: area_choices(4, u'请选择接入点'))
    name = TextField(u'CPE名称', validators=[required(message=u'必填')])
    alias = TextField(u'CPE别名', validators=[required(message=u'必填')])
    mac = TextField(u'MAC地址', validators=[required(message=u'必填')])
    vendor = QuerySelectField(
        u'CPE厂商',
        query_factory=lambda: Vendor.query.filter(Vendor.is_valid == 1),
        allow_blank=True,
        blank_text=u'请选择厂商',
        get_label='alias')
    model = QuerySelectField(
        u'CPE型号',
        query_factory=lambda: Model.query.filter(Model.is_valid == 1).filter(
            Model.category_id == 51),
        allow_blank=True,
        blank_text=u'请选择型号',
        get_label='alias')
    esn = TextField(u'ESN')
    owner = TextField(u'用户名')
    card_id = TextField(u'身份证号')
    contact_tel = TextField(u'联系电话')
    location = TextField(u'安装地址')
    install_time = DateFieldPro(u'安装时间')
    remark = TextAreaField(u'备注信息')
Beispiel #4
0
class UserNewForm(Form):
    username = TextField(u'用户名', validators=[required(message=u'必填')])
    name = TextField(u'真实姓名', validators=[required(message=u'必填')])
    password = PasswordField(
        u'密码', validators=[required(message=u'必填'),
                           v.Length(min=6, max=20)])
    password_confirm = PasswordField(u'重复密码',
                                     validators=[
                                         required(message=u'必填'),
                                         equal_to('password',
                                                  message=u'两次输入的密码不同')
                                     ])

    role_id = SelectFieldPro(
        u'角色',
        validators=[required(message=u'必填')],
        choices=lambda: [('', u'请选择角色')] + [(unicode(r.id), r.name)
                                            for r in Role.query])

    domain_id = SelectFieldPro(
        u'管理域',
        validators=[required(message=u'必填')],
        choices=lambda: [('', u'请选择管理域')] + [(unicode(d.id), d.name)
                                             for d in Domain.query])

    department = TextField(u'部门')
    email = TextField(
        u'邮箱',
        validators=[required(message=u'必填'),
                    email(message=u'不是合法的邮箱地址')])
    telephone = TextField(u'电话')
    mobile = TextField(u'手机', validators=[validate_mobile()])
    memo = TextAreaField(u'备注')
Beispiel #5
0
class BranchNewForm(FormPro):
    cityid = SelectFieldPro(u'所属地市', choices=lambda: area_choices(1, u'请选择地市'))
    parent_id = SelectFieldPro(u'所属区县',
                               validators=[required(message=u'必填')],
                               choices=lambda: area_choices(2, u'请选择区县'))
    name = TextField(u'分局名称', validators=[required(message=u'必填')])
    alias = TextField(u'分局别名', validators=[required(message=u'必填')])
    longitude = DecimalFieldPro(u'经度')
    latitude = DecimalFieldPro(u'纬度')
    remark = TextAreaField(u'备注')
Beispiel #6
0
class RouterSearchForm(FormPro):
    keyword = TextField()
    area = AreaSelectField(u'所属区域')
    vendor_id = SelectFieldPro(
        u'生产厂商',
        choices=lambda: [('', u'请选择生产厂商')] + [(unicode(r.id), r.alias)
                                              for r in Vendor.query])
    model_id = SelectFieldPro(
        u'设备型号',
        choices=lambda: [('', u'请选择设备型号')] + [(unicode(r.id), r.alias)
                                              for r in Model.query])
    status = SelectFieldPro(
        u'状态', choices=lambda: [('', u'请选择状态')] + NODE_STATUS_DICT.items())
Beispiel #7
0
class TownNewForm(FormPro):
    parent_id = SelectFieldPro(u'所属地市',
                               validators=[required(message=u'必填')],
                               choices=lambda: area_choices(1, u'请选择地市'))
    name = TextField(u'区县名称', validators=[required(message=u'必填')])
    alias = TextField(u'区县别名', validators=[required(message=u'必填')])
    longitude = DecimalFieldPro(u'经度')
    latitude = DecimalFieldPro(u'纬度')
    remark = TextAreaField(u'备注')
Beispiel #8
0
class AreaStatisticsForm(FormPro):
    area = AreaSelectField(u'统计区域')
    query_gran = SelectFieldPro(u'统计粒度',
                                choices=[
                                    ('1', u'地市'),
                                    ('2', u'区县'),
                                    ('3', u'分局'),
                                    ('4', u'接入点'),
                                ])
Beispiel #9
0
class EocNewForm(FormPro):
    cityid = SelectFieldPro(u'所属地市', choices=lambda: area_choices(1, u'请选择地市'))
    town = SelectFieldPro(u'', choices=lambda: area_choices(2, u'请选择区县'))
    area_id = SelectFieldPro(u'所属区域',
                             validators=[required(message=u'必填')],
                             choices=lambda: area_choices(3, u'请选择分局'))
    name = TextField(u'EOC名称', validators=[required(message=u'必填')])
    alias = TextField(u'EOC别名', validators=[required(message=u'必填')])
    addr = TextField(u'IP 地址',
                     validators=[
                         required(message=u'必填'),
                         IPAddress(message=u'IP地址格式不正确'),
                         NoneOf(['0.0.0.0', '255.255.255.255'],
                                message=u'IP地址格式不正确')
                     ])
    snmp_comm = TextField(u'读团体名', validators=[required(message=u'必填')])
    snmp_wcomm = TextField(u'写团体名', validators=[required(message=u'必填')])
    snmp_ver = RadioField(u'SNMP版本',
                          default=SNMP_VER_DICT.keys()[0],
                          validators=[required(message=u'必填')],
                          choices=[(value, label)
                                   for value, label in SNMP_VER_DICT.items()])
    vendor = QuerySelectField(
        u'EOC厂商',
        query_factory=lambda: Vendor.query.filter(Vendor.is_valid == 1),
        allow_blank=True,
        blank_text=u'请选择厂商',
        get_label='alias')
    model = QuerySelectField(
        u'EOC型号',
        query_factory=lambda: Model.query.filter(Model.is_valid == 1).filter(
            Model.category_id == 50),
        allow_blank=True,
        blank_text=u'请选择型号',
        get_label='alias')
    mask = TextField(u'子网掩码')
    esn = TextField(u'ESN')
    owner = TextField(u'维护人员')
    contact_tel = TextField(u'联系电话')
    location = TextField(u'安装地址')
    install_time = DateFieldPro(u'安装时间')
    remark = TextAreaField(u'备注信息')
Beispiel #10
0
class AlarmClassForm(Form):
    id = HiddenField(u'Id')
    severity = SelectFieldPro(u'级别',
                              validators=[required(message=u'必填')],
                              choices=lambda: [(unicode(r.id), r.alias)
                                               for r in AlarmSeverity.query])
    #x733_type       = tables.Column(verbose_name=u'X733类型')
    probable_cause = TextAreaField(u'可能原因')
    specific_problem = TextAreaField(u'特定原因')
    additional_info = TextAreaField(u'附加信息')
    remark = TextAreaField(u'备注')
Beispiel #11
0
class AlarmKnowledgeForm(Form):
    class_id = SelectFieldPro(
        u'告警类型',
        validators=[required(message=u'必填')],
        choices=lambda: [('', u'Choice')] + [(unicode(r.id), r.alias)
                                             for r in AlarmClass.query])
    probability = SelectField(u'发生几率',
                              validators=[required(message=u'必填')],
                              choices=[(unicode(1), u'极少发生'),
                                       (unicode(2), u'偶尔发生'),
                                       (unicode(3), u'频繁发生')])
    probable_cause = TextAreaField(u'可能原因')
    resolvent = TextAreaField(u'解决方案')
Beispiel #12
0
class OnuNewForm(FormPro):
    ctrl_id = SelectFieldPro(u'所属OLT',
                             validators=[required(message=u'必填')],
                             choices=lambda: olt_choices(3, u'请选择OLT'))
    area_id = SelectFieldPro(u'接入点',
                             validators=[required(message=u'必填')],
                             choices=lambda: area_choices(4, u'请选择接入点'))
    name = TextField(u'ONU名称', validators=[required(message=u'必填')])
    alias = TextField(u'ONU别名', validators=[required(message=u'必填')])
    addr = TextField(u'IP 地址',
                     validators=[
                         required(message=u'必填'),
                         IPAddress(message=u'IP地址格式不正确'),
                         NoneOf(['0.0.0.0', '255.255.255.255'],
                                message=u'IP地址格式不正确')
                     ])
    snmp_comm = TextField(u'读团体名', validators=[required(message=u'必填')])
    snmp_wcomm = TextField(u'写团体名', validators=[required(message=u'必填')])
    snmp_ver = RadioField(u'SNMP版本',
                          default=SNMP_VER_DICT.keys()[0],
                          validators=[required(message=u'必填')],
                          choices=[(value, label)
                                   for value, label in SNMP_VER_DICT.items()])
    vendor_id = SelectFieldPro(
        u'ONU厂商',
        validators=[required(message=u'必填')],
        choices=lambda: [('', u'请选择厂商')] + [(unicode(r.id), r.alias)
                                            for r in Vendor.query.filter(
                                                Vendor.is_valid == 1)])
    model_id = SelectFieldPro(u'ONU型号',
                              validators=[required(message=u'必填')],
                              choices=lambda: [('', u'请选择型号')] +
                              [(unicode(r.id), r.alias)
                               for r in Model.query.filter(Model.is_valid == 1)
                               .filter(Model.category_id == 21)])
    mask = TextField(u'子网掩码')
    location = TextField(u'位置')
    remark = TextAreaField(u'备注信息')
Beispiel #13
0
class UserEditForm(Form):
    name = TextField(u'真实姓名', validators=[required(message=u'必填')])

    role_id = SelectFieldPro(
        u'角色',
        validators=[required(message=u'必填')],
        choices=lambda: [('', u'请选择角色')] + [(unicode(r.id), r.name)
                                            for r in Role.query])

    domain_id = SelectFieldPro(
        u'管理域',
        validators=[required(message=u'必填')],
        choices=lambda: [('', u'请选择管理域')] + [(unicode(d.id), d.name)
                                             for d in Domain.query])

    department = TextField(u'部门')
    email = TextField(
        u'邮箱',
        validators=[required(message=u'必填'),
                    email(message=u'不是合法的邮箱地址')])
    telephone = TextField(u'电话')
    mobile = TextField(u'手机', validators=[validate_mobile()])
    memo = TextAreaField(u'备注')