compilation.js 2.1 KB

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