|
@@ -1,23 +1,23 @@
|
|
-'use strict';
|
|
|
|
-const Schema = require('mongoose').Schema;
|
|
|
|
-const moment = require('moment');
|
|
|
|
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
|
-const { ObjectId } = require('mongoose').Types;
|
|
|
|
|
|
+"use strict";
|
|
|
|
+const Schema = require("mongoose").Schema;
|
|
|
|
+const moment = require("moment");
|
|
|
|
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
|
|
|
|
+const { ObjectId } = require("mongoose").Types;
|
|
// 绩效申请表
|
|
// 绩效申请表
|
|
const apply = {
|
|
const apply = {
|
|
title: { type: String }, //标题
|
|
title: { type: String }, //标题
|
|
apply_year: { type: String }, // 申请年度
|
|
apply_year: { type: String }, // 申请年度
|
|
- project_info: { type: Object }, // 项目信息
|
|
|
|
- apply_index: { type: Array }, // 绩效指标
|
|
|
|
|
|
+ project_info: { type: Object, default: {} }, // 项目信息
|
|
|
|
+ apply_index: { type: Array, default: [] }, // 绩效指标
|
|
status: { type: String, default: "0" }, // 0:草稿,1:待审中,2:审核通过,3:审核拒绝
|
|
status: { type: String, default: "0" }, // 0:草稿,1:待审中,2:审核通过,3:审核拒绝
|
|
record: { type: Array }, // 记录
|
|
record: { type: Array }, // 记录
|
|
remark: { type: String },
|
|
remark: { type: String },
|
|
};
|
|
};
|
|
const schema = new Schema(apply, { toJSON: { virtuals: true } });
|
|
const schema = new Schema(apply, { toJSON: { virtuals: true } });
|
|
schema.index({ id: 1 });
|
|
schema.index({ id: 1 });
|
|
-schema.index({ 'meta.createdAt': 1 });
|
|
|
|
|
|
+schema.index({ "meta.createdAt": 1 });
|
|
schema.plugin(metaPlugin);
|
|
schema.plugin(metaPlugin);
|
|
-module.exports = app => {
|
|
|
|
|
|
+module.exports = (app) => {
|
|
const { mongoose } = app;
|
|
const { mongoose } = app;
|
|
- return mongoose.model('Apply', schema, 'apply');
|
|
|
|
|
|
+ return mongoose.model("Apply", schema, "apply");
|
|
};
|
|
};
|