compilation.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. fileTypes:[Number]//创建项目时可用文件类型 估算,概算,预算
  26. },{_id: false});
  27. let modelSchema = {
  28. // 是否发布
  29. is_release: {
  30. type: Boolean,
  31. default: false
  32. },
  33. // 自增id
  34. id: {
  35. type: Number
  36. },
  37. // 建议估算
  38. suggestion_valuation: {
  39. type: [childrenSchema],
  40. default: []
  41. },
  42. // 可行性估算
  43. feasibility_valuation: {
  44. type: [childrenSchema],
  45. default: []
  46. },
  47. // 概算
  48. rough_valuation: {
  49. type: [childrenSchema],
  50. default: []
  51. },
  52. // 预算
  53. bill_valuation: {
  54. type: [childrenSchema],
  55. default: []
  56. },
  57. // 工程量清单
  58. ration_valuation: {
  59. type: [childrenSchema],
  60. default: []
  61. },
  62. //估算
  63. estimation_valuation: {
  64. type: [childrenSchema],
  65. default: []
  66. },
  67. // 名称
  68. name: String,
  69. // 创建时间
  70. create_time: Number,
  71. // 创建者id
  72. creator: String,
  73. //描述
  74. description: String,
  75. //代码覆盖路径
  76. overWriteUrl:String,
  77. //例题建设项目ID
  78. example: Array,
  79. // 版本号
  80. edition: String,
  81. // 发布时间
  82. release_time: {
  83. type: Number,
  84. default: 0
  85. },
  86. //价格属性
  87. priceProperties: {
  88. type: Array,
  89. default: []
  90. },
  91. //消耗量属性
  92. consumeAmtProperties: {
  93. type: Array,
  94. default: []
  95. },
  96. // cld 办事处id
  97. categoryID: {
  98. type: Number,
  99. default: 12 // 总部id
  100. },
  101. defaultLocation:String,//默认工程所在地
  102. freeUse:Boolean
  103. };
  104. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));