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 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. name: String,
  63. // 创建时间
  64. create_time: Number,
  65. // 创建者id
  66. creator: String,
  67. //描述
  68. description: String,
  69. //代码覆盖路径
  70. overWriteUrl:String,
  71. //例题建设项目ID
  72. example: Array,
  73. // 发布时间
  74. release_time: {
  75. type: Number,
  76. default: 0
  77. },
  78. //价格属性
  79. priceProperties: {
  80. type: Array,
  81. default: []
  82. },
  83. //消耗量属性
  84. consumeAmtProperties: {
  85. type: Array,
  86. default: []
  87. },
  88. // cld 办事处id
  89. categoryID: {
  90. type: Number,
  91. default: 12 // 总部id
  92. },
  93. defaultLocation:String//默认工程所在地
  94. };
  95. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));