product.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. return [
  3. "field" => [
  4. '产品名称' => [
  5. 'key' =>'title',
  6. 'rule' =>'',
  7. 'other_rule' => 'require|unique:Product',
  8. ],
  9. '产品分类' => [
  10. 'key' =>'product_category_id',
  11. 'db_search' => [
  12. 'db_name' => 'ProductCategory',
  13. 'key' => 'title',
  14. 'value' => 'id',
  15. ],
  16. 'other_rule' => 'require',
  17. ],
  18. '产品编码' => [
  19. 'key' =>'code',
  20. 'rule' => '',
  21. 'other_rule' => 'require|unique:Product',
  22. ],
  23. '规格' => [
  24. 'key' =>'size',
  25. 'rule' =>'',
  26. 'other_rule' => '',
  27. ],
  28. '单位' => [
  29. 'key' =>'unit',
  30. 'rule' =>'',
  31. 'other_rule' => '',
  32. 'db_search' => [
  33. 'db_name' => 'BasicType',
  34. 'key' => 'title',
  35. 'value' => 'id',
  36. ],
  37. ],
  38. '条码' => [
  39. 'key' =>'bar_code',
  40. 'rule' =>'',
  41. 'other_rule' => '',
  42. ],
  43. '成本' => [
  44. 'key' =>'cost',
  45. 'rule' =>'',
  46. 'other_rule' => 'require|is_numeric',
  47. ],
  48. '零售价' => [
  49. 'key' =>'retail_price',
  50. 'rule' =>'',
  51. 'other_rule' => 'is_numeric',
  52. ],
  53. ],
  54. //(特殊) 额外表头字段数组名 因为一般这个数据理论上是无限的 所以放在子表里 结构是数组
  55. "dynamics_field" => [
  56. "name" => "basic_type_22",
  57. "func" => "productTitle",
  58. ],
  59. "other_field_func" => "fillInsertProductData",// (特殊)需要填充的其它字段 这里是为了前端组件渲染的数据
  60. "table" => [
  61. "Product" => [
  62. "field" => ["title","product_category_id","code","size","unit","bar_code","cost","retail_price","crt_id","mark","crt_time","depart_id","top_depart_id"],
  63. ],
  64. "ProductPriceDetail" => [
  65. "field_array" => [
  66. "basic_type_22" => [
  67. "product_id","basic_type_id","price","crt_time"
  68. ],
  69. ],
  70. "need_param" => "product_id",
  71. "db_name" => "Product",
  72. "db_key" => "id",
  73. ],
  74. ],
  75. ];