compilation.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. compilationArea: String,
  88. // 发布时间
  89. release_time: {
  90. type: Number,
  91. default: 0,
  92. },
  93. //价格属性
  94. priceProperties: {
  95. type: Array,
  96. default: [],
  97. },
  98. //消耗量属性
  99. consumeAmtProperties: {
  100. type: Array,
  101. default: [],
  102. },
  103. // cld 办事处id
  104. categoryID: {
  105. type: Number,
  106. default: 12, // 总部id
  107. },
  108. defaultLocation: String, //默认工程所在地
  109. type: String, //编办类型
  110. freeUse: Boolean,
  111. customMade: Boolean, // 定制编办
  112. };
  113. mongoose.model(
  114. collectionName,
  115. new Schema(modelSchema, { versionKey: false, collection: collectionName })
  116. );