compilation.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. {
  13. id: String,
  14. // 计价名称
  15. name: String,
  16. // 是否启用
  17. enable: {
  18. type: Boolean,
  19. default: false,
  20. },
  21. // 类型
  22. type: {
  23. type: Number,
  24. },
  25. fileTypes: [Number], //创建项目时可用文件类型 估算,概算,预算 变更预算
  26. },
  27. { _id: false }
  28. );
  29. let modelSchema = {
  30. // 是否发布
  31. is_release: {
  32. type: Boolean,
  33. default: false,
  34. },
  35. // 自增id
  36. id: {
  37. type: Number,
  38. },
  39. // 清单计价规则
  40. bill_valuation: {
  41. type: [childrenSchema],
  42. default: [],
  43. },
  44. // 定额计价规则
  45. ration_valuation: {
  46. type: [childrenSchema],
  47. default: [],
  48. },
  49. // 名称
  50. name: String,
  51. // 创建时间
  52. create_time: Number,
  53. // 创建者id
  54. creator: String,
  55. //描述
  56. description: String,
  57. //代码覆盖路径
  58. overWriteUrl: String,
  59. //例题建设项目ID
  60. example: Array,
  61. // 版本号
  62. edition: String,
  63. // 序号(用于排序)
  64. serialNumber: Number,
  65. // 编办地区
  66. compilationArea: String,
  67. // 发布时间
  68. release_time: {
  69. type: Number,
  70. default: 0,
  71. },
  72. //价格属性
  73. priceProperties: {
  74. type: Array,
  75. default: [],
  76. },
  77. //消耗量属性
  78. consumeAmtProperties: {
  79. type: Array,
  80. default: [],
  81. },
  82. // cld 办事处id
  83. categoryID: {
  84. type: Number,
  85. default: 12, // 总部id
  86. },
  87. defaultLocation: String, //默认工程所在地
  88. freeUse: Boolean,
  89. customMade: Boolean, // 定制编办
  90. };
  91. mongoose.model(
  92. collectionName,
  93. new Schema(modelSchema, { versionKey: false, collection: collectionName })
  94. );