abiao лет назад: 4
Родитель
Сommit
2e346ac8bb

+ 14 - 0
app/models/order.rb

@@ -246,6 +246,20 @@ class Order < ActiveRecord::Base
                 filterable true
             end
             field :depart_record
+            field :list_file do
+                read_only true
+                pretty_value do
+                    v = bindings[:view]
+                    url = ""
+                    # value will point to bindings[:object].name
+                    if value.length>0
+                        v.link_to(value, url, target: '_blank', rel: 'noopener noreferrer')
+                    else
+                        url="www.baidu.com"
+                        v.link_to(value, url, target: '_blank', rel: 'noopener noreferrer')
+                    end
+                end
+            end
             field :created_at do
                 visible false
             end

+ 2 - 0
config/locales/models/order.yml

@@ -47,3 +47,5 @@ zh-CN:
        updated_at: 修改时间
        depart: 部门
        depart_record: 部门
+       list_file: 清单
+

+ 11 - 0
db/migrate/20210413032357_add_list_file_column_to_orders.rb

@@ -0,0 +1,11 @@
+# This migration and CreateVersionAssociations provide the necessary
+# schema for tracking associations.
+class AddTransactionIdColumnToVersions < ActiveRecord::Migration
+  def self.up
+    add_column :orders, :list_file, :string,:limit => 128,:null => false, :default => ""
+  end
+
+  def self.down
+    remove_column :orders, :list_file
+  end
+end