compilation.js 1.9 KB

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