diff --git a/app/controllers/com/panel/meta_models_controller.rb b/app/controllers/com/panel/meta_models_controller.rb index 08551783..64d50d7d 100644 --- a/app/controllers/com/panel/meta_models_controller.rb +++ b/app/controllers/com/panel/meta_models_controller.rb @@ -9,7 +9,7 @@ class Panel::MetaModelsController < Panel::BaseController def index q_params = {} - q_params.merge! params.permit(:business_identifier) + q_params.merge! params.permit(:business_identifier, :table_name) @meta_models = MetaModel.default_where(q_params).order(record_name: :asc).page(params[:page]) end diff --git a/app/models/com/model/meta_model.rb b/app/models/com/model/meta_model.rb index 81ca3060..3d7d43c9 100644 --- a/app/models/com/model/meta_model.rb +++ b/app/models/com/model/meta_model.rb @@ -5,6 +5,7 @@ module Model::MetaModel included do attribute :name, :string attribute :record_name, :string, index: true + attribute :table_name, :string attribute :description, :string attribute :defined_db, :boolean, default: false attribute :customizable, :boolean, default: false, comment: '是否允许用户定制' @@ -22,6 +23,7 @@ def record_class def sync_business_identifier self.business_identifier = record_name.split('::')[-2].to_s.downcase + self.table_name = record_class.table_name end def display_name diff --git a/app/views/com/panel/meta_models/_index/_filter_form.html.erb b/app/views/com/panel/meta_models/_index/_filter_form.html.erb new file mode 100644 index 00000000..e58d5c0b --- /dev/null +++ b/app/views/com/panel/meta_models/_index/_filter_form.html.erb @@ -0,0 +1,9 @@ +<%= form_with theme: 'search', model: model_klass.new, url: { action: params[:action] }, data: { switch_target: 'src' }, class: params.key?('table_name') ? '' : 'display-none' do |f| %> +