Class: MapRequirement
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MapRequirement
- Defined in:
- app/models/map_requirement.rb
Constant Summary collapse
- FormType =
搜索类型
{ form_select: 1, #下拉 form_datetime: 2, #时间 form_text: 3 #输入 }
- SqlType =
下拉数据来源类型
{ sql_null: 0, #自定义下拉 sql_dict: 1, #字典 sql_query: 2 #sql查询所得 }
Class Method Summary collapse
Instance Method Summary collapse
- #dict_options ⇒ Object
-
#form_type_name ⇒ Object
enum sql_type: SqlType.
- #select_options ⇒ Object
- #sql_options ⇒ Object
- #sql_type_name ⇒ Object
Class Method Details
Instance Method Details
#dict_options ⇒ Object
51 52 53 |
# File 'app/models/map_requirement.rb', line 51 def eval(self.dictionary || "{}").collect{|k, v| [k, v] } end |
#form_type_name ⇒ Object
enum sql_type: SqlType
20 21 22 23 24 |
# File 'app/models/map_requirement.rb', line 20 def form_type_name return "输入" if self.form_type == FormType[:form_text] return "时间" if self.form_type == FormType[:form_datetime] return "下拉" if self.form_type == FormType[:form_select] end |
#select_options ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/models/map_requirement.rb', line 39 def if self.sql_type == SqlType[:sql_dict] self. elsif self.sql_type == SqlType[:sql_query] self. end end |
#sql_options ⇒ Object
47 48 49 |
# File 'app/models/map_requirement.rb', line 47 def self.report.connect.exec(self.sql_str).collect{|s|[s["name"], s["value"]]} end |