installation_fee.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * Created by Zhong on 2017/9/13.
  3. */
  4. import mongoose from "mongoose";
  5. let Schema = mongoose.Schema;
  6. //安装增加费-费用规则
  7. let feeRuleSchema = new Schema(
  8. {
  9. ID: String,
  10. sectionId: String, //分册章节id
  11. feeItemId: String,
  12. code: String,
  13. rule: String,
  14. base: String,
  15. feeRate: Number,
  16. labour: Number,
  17. material: Number,
  18. machine: Number,
  19. position: String, //记取位置
  20. billID: String, //记取位置对应的清单ID
  21. },
  22. { versionKey: false, _id: false }
  23. );
  24. //安装增加费-分册章节
  25. let installSectionSchema = new Schema(
  26. {
  27. ID: String,
  28. feeItemId: String,
  29. feeRuleId: String,
  30. name: String,
  31. seq: Number,
  32. },
  33. { versionKey: false, _id: false }
  34. );
  35. //安装增加费-费用项
  36. let installFeeItemSchema = new Schema(
  37. {
  38. ID: String,
  39. feeItem: String, //费用项
  40. feeType: String, //费用类型
  41. position: String, //记取位置
  42. position24: String, //24记取位置
  43. billID: String, //记取位置对应的清单ID
  44. isCal: { type: Number, default: 0 }, //是否记取0:false 1:true
  45. seq: Number,
  46. reductionRate: Number, //降效比例(%)
  47. measureRate: Number, //措施比例(%)
  48. showIn24: Boolean, //24是否显示
  49. },
  50. { versionKey: false, _id: false }
  51. );
  52. let installationFeeSchema = new Schema(
  53. {
  54. ID: String,
  55. libID: Number,
  56. libName: String,
  57. projectID: String,
  58. installFeeItem: [installFeeItemSchema],
  59. installSection: [installSectionSchema],
  60. feeRule: [feeRuleSchema],
  61. },
  62. { versionKey: false }
  63. );
  64. mongoose.model("installation_fee", installationFeeSchema, "installation_fee");