compilation.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 engineeringListSchema = new Schema({
  12. // 工程专业id
  13. engineering: {
  14. type: Number
  15. },
  16. engineering_id: {
  17. type: Schema.Types.Mixed,
  18. default: []
  19. }
  20. }, {_id: false});
  21. let childrenSchema = new Schema({
  22. id:String,
  23. // 计价名称
  24. name: String,
  25. // 工程专业列表
  26. engineering_list: {
  27. type: [engineeringListSchema],
  28. default: []
  29. },
  30. // 是否启用
  31. enable: {
  32. type: Boolean,
  33. default: false
  34. },
  35. // 类型
  36. type: {
  37. type: Number
  38. },
  39. // 列设置
  40. main_tree_col: {
  41. type: Schema.Types.Mixed,
  42. default: {
  43. "emptyRows":3,
  44. "headRows":0,
  45. "treeCol": 0,
  46. "headRowHeight":[],
  47. "cols":[]
  48. }
  49. }
  50. },{_id: false});
  51. let modelSchema = {
  52. // 是否发布
  53. is_release: {
  54. type: Boolean,
  55. default: false
  56. },
  57. // 清单计价规则
  58. bill_valuation: {
  59. type: [childrenSchema],
  60. default: []
  61. },
  62. // 定额计价规则
  63. ration_valuation: {
  64. type: [childrenSchema],
  65. default: []
  66. },
  67. // 名称
  68. name: String,
  69. //描述
  70. description: String,
  71. // 创建时间
  72. create_time: Number,
  73. // 创建者id
  74. creator: String,
  75. // 发布时间
  76. release_time: {
  77. type: Number,
  78. default: 0
  79. }
  80. };
  81. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));