1234567891011121314151617181920212223242526 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 司机表
- const Driverchema = {
- name: { type: String, required: true, maxLength: 200, field: { required: true, label: '姓名', filter: true } }, // 姓名
- tel: { type: String, required: true, maxLength: 200, field: { required: true, label: '联系电话', filter: true } }, // 电话/固定电话
- id_card: { type: String, required: true, maxLength: 200, field: { required: true, label: '身份证', filter: true, options: { maxLength: 18, minLength: 18 } } }, // 身份证
- drive_card: { type: String, required: true, maxLength: 200, field: { required: true, label: '驾驶证号' } }, // 驾驶证号
- fhc_time: { type: String, required: false, maxLength: 200, field: { label: '初次领证时间', type: 'date', notable: true } }, // 初次领证时间=年月日
- car_type: { type: String, required: false, maxLength: 200, field: { label: '准驾车型', notable: true } }, // 准驾车型
- ccu_time: { type: String, required: false, maxLength: 200, field: { required: true, label: '驾驶证有效日期', notable: true, type: 'date' } }, // 驾驶证有效日期
- cc_time: { type: String, required: false, maxLength: 200, field: { required: true, label: '驾驶证年检日期', notable: true, type: 'date' } }, // 驾驶证年检日期
- qc_time: { type: String, required: false, maxLength: 200, field: { required: true, label: '资格证年检日期', notable: true, type: 'date' } }, // 资格证年检日期
- status: { type: String, required: false, maxLength: 200, default: '在籍', field: { label: '状态', type: 'radio', filter: 'select', list: [{ label: '在籍', value: '在籍' }, { label: '注销', value: '注销' }] } },
- };
- const schema = new Schema(Driverchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Diver', schema, 'driver');
- };
|