compilation.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * 编办管理数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/28
  6. * @version
  7. */
  8. // import mongoose from "mongoose";
  9. let mongoose = require("mongoose");
  10. let Schema = mongoose.Schema;
  11. let collectionName = 'compilation';
  12. let childrenSchema = new Schema({
  13. id:String,
  14. // 计价名称
  15. name: String,
  16. // 是否启用
  17. enable: {
  18. type: Boolean,
  19. default: false
  20. },
  21. // 类型
  22. type: {
  23. type: Number
  24. }
  25. },{_id: false});
  26. let modelSchema = {
  27. // 是否发布
  28. is_release: {
  29. type: Boolean,
  30. default: false
  31. },
  32. // 自增id
  33. id: {
  34. type: Number
  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. estimation_valuation: {
  63. type: [childrenSchema],
  64. default: []
  65. },
  66. // 名称
  67. name: String,
  68. // 创建时间
  69. create_time: Number,
  70. // 创建者id
  71. creator: String,
  72. //描述
  73. description: String,
  74. //代码覆盖路径
  75. overWriteUrl:String,
  76. //例题建设项目ID
  77. example: Array,
  78. // 发布时间
  79. release_time: {
  80. type: Number,
  81. default: 0
  82. },
  83. //价格属性
  84. priceProperties: {
  85. type: Array,
  86. default: []
  87. },
  88. //消耗量属性
  89. consumeAmtProperties: {
  90. type: Array,
  91. default: []
  92. },
  93. // cld 办事处id
  94. categoryID: {
  95. type: Number,
  96. default: 12 // 总部id
  97. },
  98. defaultLocation:String//默认工程所在地
  99. };
  100. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));