compilation.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. overWriteUrl:String,
  52. // 创建时间
  53. create_time: Number,
  54. // 创建者id
  55. creator: String,
  56. // 发布时间
  57. release_time: {
  58. type: Number,
  59. default: 0
  60. },
  61. // cld 办事处id
  62. categoryID: {
  63. type: Number,
  64. default: 12 // 总部id
  65. }
  66. };
  67. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));