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