compilation.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * 编办管理数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/28
  6. * @version
  7. */
  8. const mongoose = require('mongoose');
  9. let Schema = mongoose.Schema;
  10. let collectionName = 'compilation';
  11. let childrenSchema = new Schema({
  12. id:String,
  13. // 计价名称
  14. name: String,
  15. // 工程专业列表
  16. engineering_list: {
  17. type: Schema.Types.Mixed,
  18. default: []
  19. },
  20. // 是否启用
  21. enable: {
  22. type: Boolean,
  23. default: false
  24. },
  25. // 类型
  26. type: {
  27. type: Number
  28. }
  29. },{_id: false});
  30. let modelSchema = {
  31. // 是否发布
  32. is_release: {
  33. type: Boolean,
  34. default: false
  35. },
  36. // 建议估算
  37. suggestion_valuation: {
  38. type: [childrenSchema],
  39. default: []
  40. },
  41. // 可行性估算
  42. feasibility_valuation: {
  43. type: [childrenSchema],
  44. default: []
  45. },
  46. // 概算
  47. rough_valuation: {
  48. type: [childrenSchema],
  49. default: []
  50. },
  51. // 预算
  52. bill_valuation: {
  53. type: [childrenSchema],
  54. default: []
  55. },
  56. // 工程量清单
  57. ration_valuation: {
  58. type: [childrenSchema],
  59. default: []
  60. },
  61. // 名称
  62. name: String,
  63. //描述
  64. description: String,
  65. //例题
  66. example: [],
  67. //代码覆盖路径
  68. overWriteUrl:String,
  69. // 创建时间
  70. create_time: Number,
  71. // 创建者id
  72. creator: String,
  73. // 发布时间
  74. release_time: {
  75. type: Number,
  76. default: 0
  77. },
  78. // cld 办事处id
  79. categoryID: {
  80. type: Number,
  81. default: 12 // 总部id
  82. },
  83. defaultLocation:String//默认工程所在地
  84. };
  85. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));