compilation.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. id: String,
  13. // 计价名称
  14. name: String,
  15. // 是否启用
  16. enable: {
  17. type: Boolean,
  18. default: false
  19. },
  20. // 类型
  21. type: {
  22. type: Number
  23. },
  24. fileTypes: [Number]//创建项目时可用文件类型 估算,概算,预算 变更预算
  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. bill_valuation: {
  38. type: [childrenSchema],
  39. default: []
  40. },
  41. // 定额计价规则
  42. ration_valuation: {
  43. type: [childrenSchema],
  44. default: []
  45. },
  46. // 名称
  47. name: String,
  48. // 创建时间
  49. create_time: Number,
  50. // 创建者id
  51. creator: String,
  52. //描述
  53. description: String,
  54. //代码覆盖路径
  55. overWriteUrl: String,
  56. //例题建设项目ID
  57. example: Array,
  58. // 版本号
  59. edition: String,
  60. // 发布时间
  61. release_time: {
  62. type: Number,
  63. default: 0
  64. },
  65. //价格属性
  66. priceProperties: {
  67. type: Array,
  68. default: []
  69. },
  70. //消耗量属性
  71. consumeAmtProperties: {
  72. type: Array,
  73. default: []
  74. },
  75. // cld 办事处id
  76. categoryID: {
  77. type: Number,
  78. default: 12 // 总部id
  79. },
  80. defaultLocation:String,//默认工程所在地
  81. freeUse:Boolean
  82. };
  83. mongoose.model(collectionName, new Schema(modelSchema, { versionKey: false, collection: collectionName }));