compilation.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. enable: {
  17. type: Boolean,
  18. default: false
  19. },
  20. // 类型
  21. type: {
  22. type: Number
  23. },
  24. fileTypes: [Number]//创建项目时可用文件类型 估算,概算,预算 变更预算
  25. }, { _id: false });
  26. let modelSchema = {
  27. // 是否发布
  28. is_release: {
  29. type: Boolean,
  30. default: false
  31. },
  32. // 自增id
  33. id: {
  34. type: Number
  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. create_time: Number,
  50. // 创建者id
  51. creator: String,
  52. //描述
  53. description: String,
  54. //代码覆盖路径
  55. overWriteUrl: String,
  56. //例题建设项目ID
  57. example: Array,
  58. // 版本号
  59. edition: String,
  60. // 序号(用于排序)
  61. serialNumber: Number,
  62. // 发布时间
  63. release_time: {
  64. type: Number,
  65. default: 0
  66. },
  67. //价格属性
  68. priceProperties: {
  69. type: Array,
  70. default: []
  71. },
  72. //消耗量属性
  73. consumeAmtProperties: {
  74. type: Array,
  75. default: []
  76. },
  77. // cld 办事处id
  78. categoryID: {
  79. type: Number,
  80. default: 12 // 总部id
  81. },
  82. defaultLocation: String,//默认工程所在地
  83. freeUse: Boolean
  84. };
  85. mongoose.model(collectionName, new Schema(modelSchema, { versionKey: false, collection: collectionName }));