compilation.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. // 清单计价规则
  57. bill_valuation: {
  58. type: [childrenSchema],
  59. default: []
  60. },
  61. // 定额计价规则
  62. ration_valuation: {
  63. type: [childrenSchema],
  64. default: []
  65. },
  66. // 名称
  67. name: String,
  68. // 创建时间
  69. create_time: Number,
  70. // 创建者id
  71. creator: String,
  72. // 发布时间
  73. release_time: {
  74. type: Number,
  75. default: 0
  76. }
  77. };
  78. let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
  79. export {model as default, collectionName as collectionName};