duplicate.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 绩效审核通过表(生成副本)
  7. const duplicate = {
  8. apply_id: { type: String }, // 原数据id
  9. user_id: { type: String }, // 用户id
  10. user_name: { type: String }, // 用户名
  11. title: { type: String }, // 标题
  12. apply_year: { type: String }, // 申请年度
  13. project_info: { type: Object }, // 项目信息
  14. apply_index: { type: Array }, // 绩效指标
  15. status: { type: String, default: '0' }, // 0:草稿,1:待审中,2:审核通过,3:审核拒绝
  16. record: { type: Array }, // 记录
  17. excel: { type: Object }, // excel数据
  18. remark: { type: String },
  19. };
  20. const schema = new Schema(duplicate, { toJSON: { virtuals: true } });
  21. schema.index({ id: 1 });
  22. schema.index({ apply_id: 1 });
  23. schema.index({ user_id: 1 });
  24. schema.index({ user_name: 1 });
  25. schema.index({ status: 1 });
  26. schema.index({ 'meta.createdAt': 1 });
  27. schema.plugin(metaPlugin);
  28. module.exports = app => {
  29. const { mongoose } = app;
  30. return mongoose.model('Duplicate', schema, 'duplicate');
  31. };