From 1dd77a06549473f7d3097dc3d373754d48caf3cb Mon Sep 17 00:00:00 2001 From: zhangminghua Date: Wed, 28 Dec 2022 13:55:54 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=91=98=E5=B7=A5=E6=B2=9F=E9=80=9A?= =?UTF-8?q?=E8=A1=A8=E6=A8=A1=E5=9E=8B=E6=9B=B4=E6=94=B9=EF=BC=8C=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/employeeCommunicate/index.js | 11 ++- api/app/lib/models/employee_communicate.js | 99 ++++++++++++++++++- 2 files changed, 105 insertions(+), 5 deletions(-) diff --git a/api/app/lib/controllers/employeeCommunicate/index.js b/api/app/lib/controllers/employeeCommunicate/index.js index 8c39ac4..f0073fd 100644 --- a/api/app/lib/controllers/employeeCommunicate/index.js +++ b/api/app/lib/controllers/employeeCommunicate/index.js @@ -3,14 +3,19 @@ const fs = require('fs'); const moment = require('moment'); /** * 查询员工沟通统计数据 - * @param {*} ctx ctx ctx.query:{keywordTarget-关键字项、keyword-关键字内容、limit-页宽, page-页码} + * @param {*} ctx ctx ctx.query:{keywordTarget-关键字项、keyword-关键字内容、timeRange-沟通时间、limit-页宽, page-页码} */ async function get(ctx) { try { const { models } = ctx.fs.dc; - const { keywordTarget, keyword, entryTime, limit, page } = ctx.query; + const { keywordTarget, keyword, timeRange, limit, page } = ctx.query; const where = {}; - + if (keywordTarget && keyword) { + where[keywordTarget] = { $iLike: `%${keyword}%` }; + } + if(timeRange){ + where.communicateDate= { $between: timeRange.split(',') }; + } let employeeCommunicate = await models.EmployeeCommunicate.findAndCountAll({ where: where, offset: Number(page) * Number(limit), diff --git a/api/app/lib/models/employee_communicate.js b/api/app/lib/models/employee_communicate.js index b3ef80f..796d5fd 100644 --- a/api/app/lib/models/employee_communicate.js +++ b/api/app/lib/models/employee_communicate.js @@ -1,4 +1,5 @@ /* eslint-disable*/ + 'use strict'; module.exports = dc => { @@ -8,57 +9,151 @@ module.exports = dc => { id: { type: DataTypes.INTEGER, allowNull: false, + defaultValue: null, + comment: null, primaryKey: true, field: "id", - autoIncrement: true, + autoIncrement: true }, personalName: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "personalname", + autoIncrement: false }, job: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "job", + autoIncrement: false }, departmentName: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "departmentname", + autoIncrement: false }, communicateDate: { type: DataTypes.DATE, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "communicatedate", + autoIncrement: false }, communicateContent: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "communicatecontent", + autoIncrement: false }, communicateResult: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "communicateresult", + autoIncrement: false }, valuation: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "valuation", + autoIncrement: false }, communicateCondition: { type: DataTypes.STRING, allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "communicatecondition", + autoIncrement: false }, nextPlan: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, field: "nextplan", + autoIncrement: false + }, + topic: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "topic", + autoIncrement: false + }, + communicateEndDate: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "communicateenddate", + autoIncrement: false + }, + background: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "background", + autoIncrement: false + }, + suggestion: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "suggestion", + autoIncrement: false + }, + toPersonSugges: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "topersonsugges", + autoIncrement: false + }, + training: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "training", + autoIncrement: false } }, { tableName: "employee_communicate", + comment: "", + indexes: [] }); dc.models.EmployeeCommunicate = EmployeeCommunicate; return EmployeeCommunicate;