Bladeren bron

增加快递打印单

abiao 4 jaren geleden
bovenliggende
commit
58b389fbde

+ 12 - 0
app/models/order_file.rb

@@ -46,6 +46,17 @@ class OrderFile < ActiveRecord::Base
           end
         end
       end
+      field :line_file do
+        read_only true
+        pretty_value do
+          v = bindings[:view]
+          url = value
+          # value will point to bindings[:object].name
+          if value.length>0
+            v.link_to("快递打印单", url, target: '_blank', rel: 'noopener noreferrer')
+          end
+        end
+      end
       field :status
       field :created_at
       # field :updated_at
@@ -64,6 +75,7 @@ class OrderFile < ActiveRecord::Base
       # field :depart
       field :depart_record
       field :list_file
+      field :line_file
       field :status
       field :created_at
       # field :updated_at

+ 1 - 0
config/locales/models/order_file.yml

@@ -13,6 +13,7 @@ zh-CN:
         depart: 部门
         depart_record: 部门
         list_file: 清单文件
+        line_file: 快递打印单
         status: 状态
         created_at: 创建时间
         updated_at: 更新时间

+ 11 - 0
db/migrate/20210421032357_add_line_file_column_to_order_files.rb

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