'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 projectsolic = { name: { type: String, required: false, maxLength: 500 }, // 项目名称 pro_user: { type: String, required: true, maxLength: 500 }, // 项目负责人 pro_phone: { type: String, required: true, maxLength: 500 }, // 项目负责人电话 field: { type: String, required: false, maxLength: 500 }, // 领域分类 scale: { type: String, required: false, maxLength: 500 }, // 市场预估 techol_stage: { type: String, required: false, maxLength: 500 }, // 技术阶段 techol_level: { type: String, required: false, maxLength: 500 }, // 技术水平 proposal_company: { type: String, required: false, maxLength: 500 }, // 建议单位名称 proposal_user: { type: String, required: false, maxLength: 500 }, // 建议单位联系人 proposal_phone: { type: String, required: false, maxLength: 500 }, // 建议单位联系电话 coopera_company: { type: String, required: false, maxLength: 500 }, // 合作单位名称 coopera_user: { type: String, required: false, maxLength: 500 }, // 合作单位联系人 coopera_phone: { type: String, required: false, maxLength: 500 }, // 合作单位联系电话 project_back: { type: String, required: false, maxLength: 500 }, // 项目背景 sign: { type: String, required: false, maxLength: 500 }, // 立项意义 work_basics: { type: String, required: false, maxLength: 500 }, // 前期基础 content: { type: String, required: false, maxLength: 500 }, // 研究内容 route: { type: String, required: false, maxLength: 500 }, // 技术路线 quota: { type: String, required: false, maxLength: 500 }, // 核心指标 influence: { type: String, required: false, maxLength: 500 }, // 经济效益 question_id: { type: ObjectId, required: true, maxLength: 500 }, // 调研调查表id user_id: { type: ObjectId, required: true, maxLength: 500 }, // 用户id remark: { type: String, maxLength: 200 }, status: { type: String, default: '0' }, // 0-可修改;1-不可修改 create_time: { type: String, }, }; const schema = new Schema(projectsolic, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ question_id: 1 }); schema.index({ user_id: 1 }); schema.index({ pro_user: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('ProjectSolic', schema, 'projectSolic'); };