proj_setting.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Created by Mai on 2017/9/14.
  3. */
  4. let mongoose = require("mongoose");
  5. let Schema = mongoose.Schema;
  6. let collectionName = 'proj_setting';
  7. let settingConst = {
  8. billsCalcMode: {
  9. rationContent: 0, rationPriceConverse: 1, rationPrice: 2, billsPrice: 3
  10. },
  11. zanguCalcMode: {
  12. common: 0, gatherMaterial: 1
  13. }
  14. }
  15. let billsCalcModeConst = {
  16. };
  17. // 呈现选项
  18. const displayOption = {
  19. autoHeight: 0,
  20. rationDisplay: 0
  21. };
  22. let projSettingSchema = {
  23. projectID: Number,
  24. // 列设置
  25. main_tree_col: {
  26. type: Schema.Types.Mixed,
  27. default: {}
  28. },
  29. billsCalcMode: {
  30. type: Number,
  31. default: settingConst.billsCalcMode.rationContent
  32. },
  33. zanguCalcMode: {
  34. type: Number,
  35. default: settingConst.zanguCalcMode.common
  36. },
  37. displayOption: {
  38. type: Schema.Types.Mixed,
  39. default: displayOption
  40. }
  41. };
  42. let model = mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));
  43. export {model as default, collectionName as collectionName, settingConst as settingConst, displayOption as displayOption};