compilation.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * 编办管理数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/28
  6. * @version
  7. */
  8. import mongoose from "mongoose";
  9. let Schema = mongoose.Schema;
  10. let collectionName = "compilation";
  11. let childrenSchema = new Schema(
  12. {
  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. },
  27. { _id: false }
  28. );
  29. let modelSchema = {
  30. // 是否发布
  31. is_release: {
  32. type: Boolean,
  33. default: false,
  34. },
  35. // 自增id
  36. id: {
  37. type: Number,
  38. },
  39. // 清单计价规则
  40. bill_valuation: {
  41. type: [childrenSchema],
  42. default: [],
  43. },
  44. // 定额计价规则
  45. ration_valuation: {
  46. type: [childrenSchema],
  47. default: [],
  48. },
  49. // 名称
  50. name: String,
  51. // 创建时间
  52. create_time: Number,
  53. // 创建者id
  54. creator: String,
  55. //描述
  56. description: String,
  57. //代码覆盖路径
  58. overWriteUrl: String,
  59. //例题建设项目ID
  60. example: Array,
  61. // 版本号
  62. edition: String,
  63. // 序号(用于排序)
  64. serialNumber: Number,
  65. // 发布时间
  66. release_time: {
  67. type: Number,
  68. default: 0,
  69. },
  70. //价格属性
  71. priceProperties: {
  72. type: Array,
  73. default: [],
  74. },
  75. //消耗量属性
  76. consumeAmtProperties: {
  77. type: Array,
  78. default: [],
  79. },
  80. // cld 办事处id
  81. categoryID: {
  82. type: Number,
  83. default: 12, // 总部id
  84. },
  85. defaultLocation: String, //默认工程所在地
  86. freeUse: Boolean,
  87. customMade: Boolean, // 定制编办
  88. };
  89. mongoose.model(
  90. collectionName,
  91. new Schema(modelSchema, { versionKey: false, collection: collectionName })
  92. );