compilation.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. engineering_list: {
  17. type: Schema.Types.Mixed,
  18. default: []
  19. },
  20. // 是否启用
  21. enable: {
  22. type: Boolean,
  23. default: false
  24. },
  25. // 类型
  26. type: {
  27. type: Number
  28. }
  29. },{_id: false});
  30. let modelSchema = {
  31. // 是否发布
  32. is_release: {
  33. type: Boolean,
  34. default: false
  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. description: String,
  50. //例题
  51. example: [],
  52. //代码覆盖路径
  53. overWriteUrl:String,
  54. // 创建时间
  55. create_time: Number,
  56. // 创建者id
  57. creator: String,
  58. // 发布时间
  59. release_time: {
  60. type: Number,
  61. default: 0
  62. },
  63. // cld 办事处id
  64. categoryID: {
  65. type: Number,
  66. default: 12 // 总部id
  67. }
  68. };
  69. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));