schemas.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. * Created by Zhong on 2017/12/21.
  3. */
  4. import mongoose from 'mongoose';
  5. let deleteSchema = require('../../../public/models/delete_schema');
  6. let Schema = mongoose.Schema;
  7. //补充定额章节树
  8. let compleRationSectionTreeSchema = new Schema({
  9. //用户名
  10. userId: Number,
  11. //编办
  12. compilationId: String,
  13. //标准定额库
  14. rationRepId: Number,
  15. //名称
  16. name: String,
  17. //是否是同层第一个节点
  18. isFirst: Boolean,
  19. ID: Number,
  20. NextSiblingID: Number,
  21. ParentID: Number,
  22. deleteInfo: deleteSchema
  23. }, {versionKey: false});
  24. //定额工料机
  25. let compleRationGljItemSchema = new Schema({
  26. gljId: Number,
  27. consumeAmt: String,
  28. type: String //std or complementary
  29. }, { _id: false });
  30. //辅助定额调整
  31. let compleRationAssItemSchema = new Schema({
  32. name: String,
  33. assistID: Number,
  34. assistCode: String,
  35. stdValue: String,
  36. stepValue: String,
  37. decimal: Number,
  38. carryBit: String,
  39. minValue: String,
  40. maxValue: String
  41. }, { _id: false });
  42. //安装增加费-费用规则
  43. let feeRuleSchema = new Schema({
  44. ID: String,
  45. code: String,
  46. rule: String,
  47. base: String,
  48. feeRate: Number,
  49. labour: Number,
  50. material: Number,
  51. machine: Number
  52. });
  53. //定额安装增加费用
  54. let rationInstSchema = new Schema({
  55. feeItemId: String,
  56. sectionId: String
  57. },{_id: false});
  58. //标准安装增加费-分册章节
  59. let installSectionSchema = new Schema({
  60. rationRepId: Number,
  61. ID: String,
  62. feeItemId: String,
  63. name: String,
  64. feeRule: [feeRuleSchema],
  65. deleted: false
  66. }, {versionKey: false});
  67. //标准安装增加费-费用项
  68. let installFeeItemSchema = new Schema({
  69. rationRepId: Number,
  70. ID: String,
  71. feeItem: String, //费用项
  72. feeType: String, //费用类型
  73. position: String, //记取位置
  74. section: [],
  75. deleted: false
  76. }, {versionKey: false});
  77. //补充定额
  78. let compleRationSchema = new Schema({
  79. userId: Number,
  80. compilationId: String,
  81. rationRepId: Number,
  82. ID:Number,
  83. code: String,
  84. name: String,
  85. unit: String,
  86. labourPrice: String,
  87. materialPrice: String,
  88. machinePrice: String,
  89. basePrice: String,
  90. sectionId: Number,
  91. caption: String,
  92. feeType: Number,
  93. jobContent: String,
  94. annotation: String,
  95. rationGljList: [compleRationGljItemSchema],
  96. rationCoeList: Array,
  97. rationAssList: [compleRationAssItemSchema],
  98. rationInstList: [rationInstSchema],
  99. deleteInfo: deleteSchema
  100. }, {versionKey: false});
  101. let compleRationSectionTreeModel = mongoose.model('complementary_ration_section_tree', compleRationSectionTreeSchema, 'complementary_ration_section_tree');
  102. let compleRationModel = mongoose.model('complementary_ration_items', compleRationSchema, 'complementary_ration_items');
  103. let installSectionModel = mongoose.model("std_ration_lib_installationSection", installSectionSchema, "std_ration_lib_installationSection");
  104. let installFeeItemModel = mongoose.model("std_ration_lib_installation", installFeeItemSchema, "std_ration_lib_installation");
  105. export {compleRationSectionTreeModel, compleRationModel, installSectionModel, installFeeItemModel};