123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- /*
- * @description: 编号规则
- * @Author: LanJianRong
- * @Date: 2020-11-27
- * @FilePath: \construction_management\web\viewmodels\rule.go
- */
- package viewmodels
- import validation "github.com/go-ozzo/ozzo-validation/v3"
- type Rule struct {
- Id string `form:"id" json:"id" `
- ProjectId string `form:"projectId" json:"projectId" `
- BidsectionId string `form:"bidsectionId" json:"bidsectionId" `
- SafeRule string `form:"safeRule" json:"safeRule" `
- QualityRule string `form:"qualityRule" json:"qualityRule" `
- ContractReturnRule string `form:"contractReturnRule" json:"contractReturnRule" `
- ContractPaidRule string `form:"contractPaidRule" json:"contractPaidRule" `
- }
- // 页面所需字段
- type ViewRule struct {
- SafeRule string `form:"safeRule" json:"safeRule" `
- QualityRule string `form:"qualityRule" json:"qualityRule" `
- ContractReturnRule string `form:"contractReturnRule" json:"contractReturnRule" `
- ContractPaidRule string `form:"contractPaidRule" json:"contractPaidRule" `
- }
- type ValidField struct {
- BidsectionId string `form:"bidsectionId" json:"bidsectionId" `
- Type string `form:"type" json:"type"`
- Rule string `form:"rule" json:"rule"`
- }
- type RuleCode struct {
- Eg string `from:"eg" json:"eg"`
- Date string `from:"date" json:"date"`
- Text string `from:"text" json:"text"`
- Name string `from:"name" json:"name"`
- Code string `from:"code" json:"code"`
- }
- func (l ValidField) Validate() error {
- return validation.ValidateStruct(&l,
- validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
- )
- }
- func (l ValidField) ValidateAuto() error {
- return validation.ValidateStruct(&l,
- validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
- validation.Field(&l.Type, validation.Required.Error("类型不能为空")),
- )
- }
|